How do i redirect users to a page in my app after login using universal login with (next-js)

i wanted to redirected the user to my posts page in my app after they login using universal login how do i that with code ?

Hi @adhamdoody7813,

Thanks for reaching out to the Auth0 Community!

To redirect your users to your posts page after they have logged in, please specify the redirect URL in the redirect_uri query parameter of the /authorize request.

For example:

https://{yourDomain}/authorize?
    response_type=code&
    client_id={yourClientId}&
    redirect_uri={YOUR_POSTS_PAGE_URL}&
    scope={scope}&
    audience={apiAudience}&
    state={state}

See this documentation for more details.

Please let me know if you have any questions.

Thanks,
Rueben

i forgot to mention i am using next js @rueben.tiow

Hi @adhamdoody7813,

Thank you for your response and clarification!

Using Auth0’s Next.js SDK, there are a couple of ways:

  1. In your config.ts file, specify the baseURL

    (Reference: BaseConfig | @auth0/nextjs-auth0)
  2. In your Login Handler, specify the returnTo property in the request.

    (Reference: LoginOptions | @auth0/nextjs-auth0)

Please let me know if you have any additional questions.

Thanks,
Rueben

@rueben.tiow i can’t find the config.ts file u mentioned the only file that i have is next.config.js

Hi @adhamdoody7813,

Thank you for your reply.

If you are using the Auth0 Next.js Quickstart, there should be a .env file in which you can set the AUTH0_BASE_URL value.

With that, could you please confirm if you have a chance to locate this file and include the redirect URL in the AUTH_BASE_URL value?

For example,t his is what I see in my file:

I look forward to your update.

Thanks,
Rueben

@rueben.tiow i do have the .env file