Not able to login for Auth0 in the Render Preview PR build

Hi community :waving_hand:

I’m using Auth0 with a Next.js application, deployed on Render.

  • :white_check_mark: The login works fine on the main domain:
    https://testproject-com-next.onrender.com
  • :cross_mark: But when I try to log in from a PR deployment, for example:
    https://testproject-com-pr-80.onrender.com
    — the login fails or redirects incorrectly, and I can’t complete authentication.

The PR deployment itself is working and reachable, but the login doesn’t succeed.
when i create my PR preview render will like this.

https://tesproject-com-pr-80.onrender.com/

and when i login after that it redirect to the

https://testproject-com-next.onrender.com/auth/callback?code=XRwy_x6bXazWl7jIkCAEcigXDX0KZOeRYtuvEmO9zBbsV&state=LsULUnGtb44-W28rozpgtVmH1cxJnI_dP0rxUsYFKyk
I’m sharing render screen shot.


I don’t know whether there is issue with the auth0 or render?
Can you one guide me on this?

Hi @yadavshivharakhyadav

Welcome back to the Auth0 Community!

Thank you for posting your question. When you make a build based on the PR, do you change the APP_BASE_URL to match the “new” domain that your application is hosted on?

For the settings in the Auth0, you can also use wildcards → Here’s more details about that https://auth0.com/docs/get-started/applications/wildcards-for-subdomains#wildcard-url-placeholders

Thanks
Dawid

Hello @dawid.matuszczyk,
Thank you for your response. I’m sharing my app_base_url.

My Render Application have below url in the app_base_url.

In my auth0 application below urls added.
Allowed Callback
http://localhost:3000/auth/callback, testproject.com, https://testproject-com-next.onrender.com/auth/callback,

Allowed Logout URLs
http://localhost:3000/, https://testproject.com/, https://testproject-com-next.onrender.com

Allowed Web Origins
http://localhost:3000/, https://testproject.com/, https://testproject-com-next.onrender.com

I want to mention that whenever I create a pull request, a new preview domain is generated for each PR. For example:

Since a new domain is created every time, it’s not feasible to manually add each one to the APP_BASE_URL.

So how can i overcome from thi problem.