Experiencing "Invalid verifier" error with Google OAuth in Convex Auth

Experiencing "Invalid verifier" error with Google OAuth in Convex Auth


I'm facing an issue where the user session doesn’t persist after a page refresh when using Google OAuth with Convex Auth. The authSessions table remains empty, and I’m seeing an "Invalid verifier" error in the Convex logs. Here’s my Convex backend configuration:

Environment Details
- @convex-dev/auth: ^0.0.84
- convex: ^1.24.0
- Platform: Web (Next.js with App Router)

Convex Backend Configuration (convex/auth.ts)
import Google from "@auth/core/providers/google";
import { convexAuth } from "@convex-dev/auth/server";

export const { auth, signIn, signOut, store, isAuthenticated } = convexAuth({
  providers: [Google],
});


Environment variables (GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET) are set in the Convex dashboard.

Middleware (middleware.ts)
import { convexAuthNextjsMiddleware } from "@convex-dev/auth/nextjs/server";

export default convexAuthNextjsMiddleware(undefined, {
  cookieConfig: { maxAge: 60 * 60 * 24 * 30 },
  verbose: true,
});

export const config = {
  matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
};


Error Logs (Convex Dashboard)
May 14, 19:02:40.454  auth:store  info  '`auth:store` type: verifyCodeAndSignIn'
May 14, 19:02:40.459  auth:store  error  'Invalid verifier'
May 14, 19:02:40.473  success  15ms  auth:store
May 14, 19:02:40.474  success  46ms  auth:signIn

Is there a solution that works?
Was this page helpful?