# Nextjs add dinamicly authorizationParams

**URL:** <https://community.auth0.com/t/nextjs-add-dinamicly-authorizationparams/134109>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [May 14, 2024, 3:15pm UTC](https://community.auth0.com/t/nextjs-add-dinamicly-authorizationparams/134109 "2024-05-14T15:15:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pabrodriguez](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pabrodriguez/32/56494_2.png) [@pabrodriguez](https://community.auth0.com/u/pabrodriguez)\
**Post date:** [May 14, 2024, 3:15pm UTC](https://community.auth0.com/t/nextjs-add-dinamicly-authorizationparams/134109/1 "2024-05-14T15:15:50Z")

</div>

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:

```auto
 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.

---

<div class="post-metadata">

**Author:** ![remus.ivan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/remus.ivan/32/68771_2.png) [@remus.ivan](https://community.auth0.com/u/remus.ivan)\
**Post date:** [March 27, 2025, 6:55pm UTC](https://community.auth0.com/t/nextjs-add-dinamicly-authorizationparams/134109/3 "2025-03-27T18:55:30Z")

</div>

Hi @pabrodriguez,

Welcome back to the Auth0 Community !

Answering this since it might helps others as well.  
In the latest version of NextJs it is specified that the [useSearchParams](https://nextjs.org/docs/app/api-reference/functions/use-search-params) helps you read the current URL’s **query string** , so this way you can get the connection parameter.

Then custom routes can be configured by checking the [custom routes docs](https://github.com/auth0/nextjs-auth0/blob/main/EXAMPLES.md#custom-routes) from our Auth0 SDK.

Hope this helps.  
Thanks,  
Remus

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [April 10, 2025, 6:55pm UTC](https://community.auth0.com/t/nextjs-add-dinamicly-authorizationparams/134109/4 "2025-04-10T18:55:57Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
