Vercel Preview Deployment Issues with @auth0/nextjs

Hello!

I have cloned and gotten the @auth0/nextjs example with the kitchen-sink-example working with separate auth0 and vercel accounts. I was able to use AUTH0_BASE_URL=${VERCEL_GIT_REPO_SLUG}-git-${VERCEL_GIT_COMMIT_REF}-${VERCEL_GIT_REPO_OWNER}.vercel.app in my .env.production and everything was fine. Within auth0 for the kitchen sink example I set my Allowed Callback URLS to https://*.vercel.app/api/auth/callback and Allowed Logout URLs to https://*.vercel.app/.

I have tried my best to recreate this in my actual repo for a project and I seem to be running to issues with auth0 not respecting my Allowed Callback URLs.

Here is my dynamic redirect_uri that is being set as a result of the .env.production. Below it is the exact name of the Vercel deployment and the corresponding Callback URL.

redirect_uri=https%3A%2F%2Fglossi-git-thomas%2Ftest-preview-generation-glossi.vercel.app%2Fapi%2Fauth%2Fcallback

https://glossi-git-thomas-test-preview-generation-glossi.vercel.app/api/auth/callback

You can see they are identical and I would expect this to work. However, I get the error message that this redirect-uri is not in the list of allowed callback URLs.

The Allowed Callback URL list is the same as what I showed above. Even when I explicitly add https://glossi-git-thomas-test-preview-generation-glossi.vercel.app/api/auth/callback I still get that same issue. Any help or guidance would be greatly appreciated!

Hey there!

The most effective way to handle that would be to tackle it through opening a GitHub issue in the @auth0/nextjs repo so we can address that directly with the repo maintainers. Once you have a link to it you can share it here so we can ping them. Thank you!

1 Like