Next.js Discord

Discord Forum

How to clear this error on Google provider authentication

Unanswered
Santhosh Prabhakaran posted this in #help-forum
Open in Discord
I'm using next-auth v5 in my project, I have integrated the creadentials provider and it works fine. Now I'm trying to integrate Google Provider and After signing in to my account I'm redirecting to a screen with the url "http://localhost:3000/api/auth/error?error=Configuration" indicating Server Error.

This is my auth.config.ts file
import Google from "next-auth/providers/google";
import type { NextAuthConfig } from "next-auth";
import Credentials from "next-auth/providers/credentials";
import { getUserbyEmail } from "./data/user";
import bcrypt from "bcryptjs";

export default {
  providers: [
    Google({
      clientId: process.env.GOOGLE_CLIENT_ID,
      clientSecret: process.env.GOOGLE_CLIENT_SECRET,
    }),
    Credentials({
      async authorize(credentials) {
        if (credentials.email && credentials.password) {
          const { email, password } = credentials;

          const user = await getUserbyEmail(email as string);

          if (!user || !user.password) {
            return null;
          }

          const isValid = await bcrypt.compare(
            password as string,
            user.password
          );

          if (isValid) {
            return user;
          }
        }
        return null;
      },
    }),
  ],
} satisfies NextAuthConfig;

This is how I'm accessing the button
<Button
            onClick={() =>
              signIn("google")
            }
          >
            Google
          </Button>

This is the error log looks like as shown in the image

2 Replies

Brown bear
This image shows an error related to prisma adaptar
It indicates name does not contain in your schema.