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.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With