Home > OS >  Next auth using firebase not working after deploying to vercel
Next auth using firebase not working after deploying to vercel

Time:10-27

enter image description here I have built an amazon clone and when i deployed it to vercel the signin with google is not working, and i got this error: Server error There is a problem with the server configuration.

Check the server logs for more information.

i have added my environement variables

CodePudding user response:

Kindly share screenshot of the browser console so we can get some more clarity on the error.

I had also faced a similar error once, I'll tell you how I resolved it. It may work out for you as well.

  1. Check in your .env file if you have changed the callback URL to the deployment url and not localhost

  2. You may need to generate a Nextauth secret key. You can easily do so by running the below command.

    openssl rand -base64 32

This will give you a alphanumeric string. Copy and paste that as NEXTAUTH_SECRET = 'generated-value' in the .env file

Then in your pages/api/auth/[...nextauth.js] file, add this secret as well like shown below.

import NextAuth from "next-auth"
import GoogleProvider from "next-auth/providers/google"

export default NextAuth({
  providers: [
    GoogleProvider({
      clientId: process.env.GOOGLE_CLIENT_ID,
      clientSecret: process.env.GOOGLE_CLIENT_SECRET,
    }),
    secret: process.env.NEXTAUTH_SECRET
  ],
})

If this works out it's good, else you have to share your console log's screenshot so we can debug further if needed.

CodePudding user response:

I have resolved this issue , if added uri on the cridentials of my project on google cloud platform and i added also a NEXTAUTH_SERET and redeployed the build THank you everyone

  • Related