Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

There is a problem with the server configuration. NextAuth

I used google as an auth provider with next auth. Configured all the the environment variables both in production and development. It's working perfectly in dev mode but in production it shows this error whenever i try to sign in.

I deployed the site to vercel and had setup google id, secret and NEXTAUTH_URL variables there.

like image 759
Abdul Basit Avatar asked Dec 30 '25 13:12

Abdul Basit


2 Answers

edit pages/api/auth/[...nextauth].js add(In same level as providers and possible callbacks):

secret:process.env.SECRET

and add a SECRET environment variable containing anything you want

SECRET env variable in vercel

like image 75
Ferdintel Avatar answered Jan 03 '26 10:01

Ferdintel


In the NEXT-AUTH documentation itself talks about it, in this url it sends: https://next-auth.js.org/warnings#no_secret It says to create a secret just for convenience in a local environment to be a "signature" in generating authentication tokens, and it explains how to create a secret if you want it here: https://next-auth.js.org/configuration/options#secret After generating the above secret, you just need to add it to your project by configuring an environment variable NEXTAUTH_SECRET with the random value.

like image 42
Caio Eduardo Justo Mendonça Avatar answered Jan 03 '26 12:01

Caio Eduardo Justo Mendonça



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!