@auth0/nextjs-auth0 - user returns undefined after successful login - vercel

Everything works on localhost, and my hosted site has been running fine since last year on vercel, but all of a sudden the useUser hook is not returning the user profile object, but showing successful login on the auth0 user history.
I’m guessing it’s something to do with vercel but I can’t find any answers.
There was a 400 error from the callback url at first, so I un/re-installed the npm package to a newer version, and now there is no error but my page won’t load into its logged-in state like it used to.

1 Like

Don’t know if this is your exact issue, but I was running into similar behaviour with NextJS/Vercel/nextjs-auth0 , and setting the env var AUTH0_SESSION_STORE_ID_TOKEN to false in my Vercel project settings fixed it for me.

I found this suggestion from this thread: getSession() on API route returns null when also using getSession() in middleware on Vercel · Issue #1085 · auth0/nextjs-auth0 · GitHub

Hey team!

This topic seems related to the new Auth0 Integration available new in Vercel Marketplace. This is the first version of this integration, and we welcome your feedback to improve future iterations.

You’ll need an existing Vercel project to use the new integration to build and customize the Identity flow. You can either import your project into Vercel or use a Vercel template so you don’t have to start from scratch like our SaaStart template to deploy a production-ready B2B SaaS app in minutes (learn more here).

If you find yourself having questions regarding this new integration for the next two weeks, we are hosting an Ask Me Anything session. Our Product Expert will provide comprehensive written answers on August 8th from 8 AM to 10 AM PST.

Find out more about Auth0 Integration and learn more about AMA.

Thanks!
Dawid