Next.js Discord

Discord Forum

auth0 + vercel + next.js production error during callback

Masai Lion posted this in #help-forum
Open in Discord
Masai LionOP
i have a auth0 protected next.js app that i've deployed using vercel
in production, i've been able to deploy but i've had problems when i log in and im not being redirected and logged into the app

I’ve had trouble with the user being callbacked to the home page and being logged in.
I’ve quadruple checked all the environment variable in the Vercel deployment, used all the right callback and logout URLs in the Application Settings, and it won’t work.
The callback URL is right b/c any other callback URL returns an error.
I am able to press login, go through the Universal Login Page, and enter my credentials. But when I press continue, I get redirected to an error page pointing to /api/auth/callback with the a code and state in the URL parameters
If I manually go back to the home page, I’m not logged in, but if I go to the Auth0 Users Page, it shows that: a). there was an account created if not already there and b). there was a login made by that user
My URLs are correct or else they would return a specified error page of the callback URL not being right, I’ve triple-checked my client secrets and generated secret, and I’ve replaced them tons of times, I’ve used the same custom domain in my environment variables and in the callback URLs, and I use the same AUTH0 issuer base url.
By the way, the app’s authentication on the code side uses a pages w/out the app router, as that was what was there in the tutorial when I started out, and the standard handleAuth() in the [auth0].ts file in /api/auth in my code and it is exported. that is all the configuration I’ve used. And the _app.tsx is wrapped in the tags

1 Reply

Masai LionOP
All authentication works completely normally on the locally hosted server, but the problems arise during production as usual.
Is there any other apparent thing I’ve missed in trying to figure out what is wrong?