next auth oauth_callback_error
Asked Answered
D

0

6

I am getting this error. https://next-auth.js.org/errors#oauth_callback_error expected 200 OK, got: 400 Bad Request

Please help me solve it.

THis is my next auth config

const authHandler: NextApiHandler = (req, res) => NextAuth(req, res, options)
export default authHandler

const options: NextAuthOptions = {
  providers: [
    FacebookProvider({
      clientId: process.env.FACEBOOK_CLIENT_ID,
      clientSecret: process.env.FACEBOOK_CLIENT_SECRET,
    }),
  ],
  callbacks: {
    async session({ session, token }) {
      if (session?.user) {
        session.user.id = token.id
        session.user.createdAt = token.createdAt
        session.user.role = token.role
      }
      return session
    },
    async jwt({ user, token }) {
      if (user) {
        token.id = user.id
        // @ts-ignore
        token.createdAt = user.createdAt
        // @ts-ignore
        token.role = user.role
      }

      return token
    },
  },
  session: {
    strategy: 'jwt',
  },
  adapter: PrismaAdapter(prisma),
  secret: process.env.NEXTAUTH_SECRET,
}

enter image description here]1

Dulce answered 23/2, 2022 at 18:13 Comment(3)
Are you certain your Facebook environment variables are set/correct?Serval
Did you find a solution ?Mundford
@Mundford nope no solution foundUnclinch

© 2022 - 2024 — McMap. All rights reserved.