Next.js Discord

Discord Forum

Google provider issues with next-auth v5

Unanswered
Marble gall posted this in #help-forum
Open in Discord
Marble gallOP
Hey everyone. Testing out next auth 5 and I can't seem to get Google sign in to work properly.
I followed the migration guide and currently have the following config:
import NextAuth, { NextAuthConfig } from "next-auth";
import Google from "next-auth/providers/google";

export const {
    handlers: { GET, POST },
    auth,
} = NextAuth({
    pages: {
        signIn: "auth/signin",
    },
    session: { strategy: "jwt" },
    providers: [
        Google({
            clientId: process.env.GOOGLE_CLIENT_ID,
            clientSecret: process.env.GOOGLE_CLIENT_SECRET,
        }),
    ],
} satisfies NextAuthConfig);

My api route looks like this:
export { GET, POST } from "@/lib/auth";
export const runtime = "edge";


When pressing sign in, I am taken to google for sign-in, but the application crashes on return:

 error {
[1]   error: 'invalid_client',
[1]   error_description: 'The OAuth client was not found.'
[1] }
[1] [auth][error] CallbackRouteError: Read more at https://errors.authjs.dev#callbackrouteerror
[1] [auth][cause]: Error: TODO: Handle OIDC response body error
[1]     at handleOAuth (webpack-internal:///(rsc)/./node_modules/next-auth/node_modules/@auth/core/lib/actions/callback/oauth/callback.js:80:19)
[1]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[1]     at async Module.callback (webpack-internal:///(rsc)/./node_modules/next-auth/node_modules/@auth/core/lib/actions/callback/index.js:33:41)
[1]     at async AuthInternal (webpack-internal:///(rsc)/./node_modules/next-auth/node_modules/@auth/core/lib/index.js:42:24)
[1]     at async Auth (webpack-internal:///(rsc)/./node_modules/next-auth/node_modules/@auth/core/index.js:123:29)
[1]     at async eval (webpack-internal:///(rsc)/./node_modules/next/dist/esm/server/future/route-modules/app-route/module.js:218:37)
[1] [auth][details]: {
[1]   "provider": "google"
[1] }


Any help would be really appreciated 👌

0 Replies