Next.js Discord

Discord Forum

NextAUTH not working for some reason

Unanswered
Spectacled Caiman posted this in #help-forum
Open in Discord
Original message was deleted.

12 Replies

Shy Albatross
is your NEXTAUTH_URL correct where you host the app?
@Shy Albatross is your `NEXTAUTH_URL` correct where you host the app?
Spectacled Caiman
Do I have to add that within my .env? If so then no I haven't set that
you don't normally keep .envs other than .env.local on the repo, for remote deployments there's other ways to set env vars in that environment, like project settings on Vercel
Spectacled Caiman
yeah thats what I mean .env.local
Shy Albatross
since you are using Vercel based on the screenshot, then it's where you should set it - in project settings -> environment variables on Vercel dashboard
Spectacled Caiman
Done, do you I have to redeploy or no
Shy Albatross
on .env.local it would be something like NEXTAUTH_URL=http://localhost:3000 whereas on Vercel, for production, you need to set it to the production domain
Spectacled Caiman
yea
Shy Albatross
I think you do have to redeploy for new ENV to kick in, not 100% sure
Spectacled Caiman
alr alr thanks
Could this be related to this?