using the latest version of auth.js
For some reason I can’t figure out, when I set up Google OAuth, I run into this issue when testing the integration:
Context:
I’m using the Prisma adapter to implement Google OAuth in my system:
src/lib/auth.ts
import NextAuth from "next-auth";
import { PrismaAdapter } from "@auth/prisma-adapter";
import { Client } from "@/utils/prisma";
import Google from "next-auth/providers/google";
export const { handlers, auth, signIn, signOut } = NextAuth({
adapter: PrismaAdapter(Client),
providers: [
Google({
clientId: process.env.AUTH_GOOGLE_ID,
clientSecret: process.env.AUTH_GOOGLE_SECRET,
}),
],
});
src/app/api/auth/[...nextauth]/route.ts
import { handlers } from "@/lib/auth";
export const { GET, POST } = handlers;
I’m sure the .env
file is set up correctly, and I’ve verified permissions in the Google console. I’ve also added myself as a test user in the Google console. When I click the sign-in button on my page, it redirects me to the Google account selector. However, after selecting my account, I encounter the error shown above. 😢
Any insights on what might be going wrong would be greatly appreciated!
things i tried and failed to give useful information
first thing i tried
- with some hope to fixing this, i went to the google console and checked all the permits it may or not need. The outcome was the same.
second thing i tried
- Reading the full auth.js docs, and did not find anything really useful to use to solve this error.
third thing i tried and failed
- tried to see the logs on the dev server, did not find anything useful, perhaps i did not get any error.