I am using Google as the authentication provider for next authentication. Configure all environment variables in production and development. It runs perfectly in development mode on my local machine but in production it shows the error "Server Error There is a problem with the server configuration.
Whenever I try to log in, check the server logs for more information.
I deployed the website to vercel and set the google id, secret and NEXTAUTH_URL variables there.
This is the code I use
import NextAuth from "next-auth" import GoogleProvider from 'next-auth/providers/google' export const authOptions = { // Configure one or more authentication providers providers: [ GoogleProvider({ clientId: process.env.GOOGLE_ID, clientSecret: process.env.GOOGLE_SECRET, }), // ...add more providers here ], } export default NextAuth(authOptions)
I tried adding all environment variables to vercel but it didn't work and I also redeployed several times
Maybe it has something to do with nextauth itself. Both secrets should be set on vercel: