# Redirect user to a dynamic route which is basically its userId or organizationId got from IdToken

**URL:** <https://community.auth0.com/t/redirect-user-to-a-dynamic-route-which-is-basically-its-userid-or-organizationid-got-from-idtoken/132547>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [April 22, 2024, 6:28pm UTC](https://community.auth0.com/t/redirect-user-to-a-dynamic-route-which-is-basically-its-userid-or-organizationid-got-from-idtoken/132547 "2024-04-22T18:28:19Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [April 23, 2024, 2:59pm UTC](https://community.auth0.com/t/redirect-user-to-a-dynamic-route-which-is-basically-its-userid-or-organizationid-got-from-idtoken/132547/4 "2024-04-23T14:59:09Z")

</div>

Hi there @veshall , welcome back 🖐

In general, we can redirect users after the login only to the Allowed Callback URLs listed in the application’s settings:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/2/e/2e87f29c056667b66ac92deb19676709c5ca60f1.png)

For scenarios where dynamic callbacks are desired, we suggest providing one callback URL for all those /organization/[orgId] URLs and leveraging the state parameter during authentication.

Here, the concept is explained generically - [How do I set up a dynamic Allowed Callback URL?](https://community.auth0.com/t/how-do-i-set-up-a-dynamic-allowed-callback-url/60268)

I also found the topic where the `getLoginState` is used to redirect the user to the origin/referer URL but you may try to go analogically with your use case - [Redirecting back to starting page dynamically with nextjs-auth0](https://community.auth0.com/t/redirecting-back-to-starting-page-dynamically-with-nextjs-auth0/71460)

Here is the library reference: [LoginOptions | @auth0/nextjs-auth0](https://auth0.github.io/nextjs-auth0/interfaces/handlers_login.LoginOptions.html#returnTo)

Feel free to try this out, and please let us know if you have any follow-up questions along the way.

---

_[View the full topic](https://community.auth0.com/t/redirect-user-to-a-dynamic-route-which-is-basically-its-userid-or-organizationid-got-from-idtoken/132547)._
