I am developing an admin area for a website, using NextJS 10, Tailwind and next-auth for the auth layer. As next-auth provider I use Auth0, which works like a charm locally, unfortunately, not on the server (Vercel).
Instead of being redirected to auth0, I get an error:
Errors | NextAuth.js /api/auth/csrf TypeError: Failed to fetch
As the link in the error msg suggests,
NEXTAUTH_URL envionment variable should be added, which, it is, pointing to the canonical URL of the site. I also checked the Allowed Redirect URLs for the app in the dashboard, this all seems fine.
Vercel’s serverless function logs show hits onto /admin and /api/auth/session as expected, but then nothing else happens, no redirect… I have only the clue with csrf token mismatch thing, but I don’t know enough about it to debug properly.
I am running out of ideas, perhaps someone here has one