Auth.js · Google page

Google: Error 400 redirect_uri_mismatch

verified on · next-auth 5.0.0-beta.32 · @auth/core 0.41.3 · Next.js 16.4.5

Check yours: npm ls next-auth @auth/core next · On a different version? Paste your package.json into the free Doctor and it checks your versions against these fixes.

what it looks like
Access blocked: This app's request is invalid · Error 400: redirect_uri_mismatch

What it means

The redirect_uri Auth.js sent to Google isn't in the Authorized redirect URIs list on the OAuth client your app uses. Google compares the whole string: scheme, host, port, path, case and trailing slash all have to match. Unlike a GitHub OAuth app, one Google client can hold several URIs, so localhost and production can share it.

Common causes

  • Only the localhost callback URL was added to the client, never the production one
  • http vs https, www vs no www, or a trailing slash
  • The URI was added to a different OAuth client than the AUTH_GOOGLE_ID in production
  • A preview deployment URL. Google doesn't allow wildcards, so *.vercel.app can't be registered
  • The change was saved a few minutes ago. Google says it can take 5 minutes to a few hours to apply

How to fix it

  1. Open the request details on Google's error page (or the redirect_uri= value in the address bar) and copy the exact redirect_uri
  2. In Google Cloud console go to Google Auth Platform > Clients (older menus: APIs & Services > Credentials) and open the Web client whose ID matches AUTH_GOOGLE_ID
  3. Under Authorized redirect URIs add your production callback URL (your domain plus /api/auth/callback/google), keep the localhost one, and save
  4. Make sure production has AUTH_GOOGLE_ID and AUTH_GOOGLE_SECRET from that same client
  5. For previews, Auth.js supports a stable redirect proxy via AUTH_REDIRECT_PROXY_URL
  6. Wait a few minutes, then retry in a private window
Google OAuth client (Web application)
Authorized redirect URIs
http://localhost:3000/api/auth/callback/google
https://your-domain.com/api/auth/callback/google

works with next-auth 5.0.0-beta.32 · @auth/core 0.41.3 · Next.js 16.4.5last verified

Prompt for Cursor or Claude Code

Google sign-in fails in production with Error 400: redirect_uri_mismatch. Tell me the exact callback URL my app sends to Google (base path /api/auth, provider google) for my production domain, check that production sets AUTH_GOOGLE_ID and AUTH_GOOGLE_SECRET, and check nothing adds a trailing slash or forces http.

Not quite your error? Paste yours into the free VibeBoot Doctor or browse the Auth.js error fixer.

Check your whole repo from the terminal: npx github:vibeboot/vibeboot-doctor (free, offline).

next: skip the next one

Skip the setup. The VibeBoot SaaS Starter ships Auth.js v5 already wired (GitHub sign-in, optional email magic links, Prisma adapter), plus Stripe and a database on Next.js 16. $49, one-time.

14-day money-back guarantee · lifetime updates

$ fixed it? get the next one first

New fixes for what AI agents break, by email.

When we add a fix or a Cursor rule for a new Next.js, Auth.js, Prisma or Stripe break, it goes out in the VibeBoot newsletter. Free, occasional, unsubscribe in one click.

Subscribe free