Next.js Discord

Discord Forum

NextAuth is not working in the deployed NextJS application.

Unanswered
Santhosh Prabhakaran posted this in #help-forum
Open in Discord
I'm facing an issue with my Next.js 13 application deployed on Vercel, which utilizes Firebase as the backend and Next-Auth for authentication, specifically using the Google provider. During development, I set the authorized redirect URL in the Google Cloud Console as "http://localhost:3000/api/auth/callback/google", and everything worked fine. However, when deploying the application to production and updating the authorized redirect URL to "https://cloud-storage-mu.vercel.app/api/auth/callback/google", I encountered a "Server error - There is a problem with the server configuration" message when attempting to sign in with Google.

Additionally, I've used the "cloud-storage-mu.vercel.app" from my deployed application's url. If it is wrong, How to set the production url in the above case ?

Any help on this would be appreciated.

16 Replies

Where to check this server log ?
This is what I'm getting
And I checked it. It's the same secret as in the Google Cloud Console. 🥲
@Santhosh Prabhakaran This is what I'm getting
set a NEXTAUTH_SECRET env var in the vercel app and redeploy
But still getting the same error
Original message was deleted
as in, set the env variable in this section
also please rotate your secrets asap
these are secrets, not supposed to be pushed to github or posted in a public server like this
It's working now
Thanks a lot. Is Client keys are necessary for every deployment ?
@Santhosh Prabhakaran Thanks a lot. Is Client keys are necessary for every deployment ?
i don't know about google/firebase-specific secrets since it depends on your application; but if you use next-auth then [the secret is necessary for production deployment](https://next-auth.js.org/errors#no_secret)
keep it the same between deployments i.e. you shouldn't set a new secret every time you deploy
Got it, Thanks again !