Reputation: 51
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.
Upvotes: 3
Views: 14782
Reputation: 589
##check NEXTAUTH_SECRET You must include NEXTAUTH_SECRET (if you use nextAuth) in your production deployment as it may throw an error otherwise, although it works locally. refer to this linkenter link description here enter image description here
Upvotes: 0
Reputation: 71
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
Upvotes: 7
Reputation: 19
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.
Upvotes: 2