Nextjs add dinamicly authorizationParams

I am migrating an application made in Angular to Nextjs 14.

I have already integrated it with Auth0, and it works well.

In my Angular app, if the URL is http:localhost:3000, I log in with the default configuration, but if the URL has an extra parameter, for example: http:localhost:3000/callback?connection=any-connection, I need to log in by adding the connection from the URL to authorizationParams.

Here is my code in angular:

 private checkConnection(): boolean {
    const connection =
      this.activeRoute.snapshot.queryParamMap.get('connection');

    if (connection) {
      this.auth.loginWithRedirect({
        authorizationParams: {
          connection,
        },
      });
      return true;
    }

    return false;
  }

My question is: how can I achieve this same behavior in Nextjs?

Thank you very much for your help.