Error 400: redirect_uri_mismatch (Google sign-in)
Published
The error
Error 400: redirect_uri_mismatch. The redirect URI in the request does not match the ones authorized
Why it happens
The callback URL your app sends to Google isn't listed exactly (scheme, domain, path, trailing slash) in Google Cloud Console → Credentials → OAuth client → Authorized redirect URIs.
How to fix it
- Copy the redirect_uri from the error details.
- Add it exactly in Google Cloud Console → APIs & Services → Credentials → your OAuth client.
- For NextAuth/Auth.js it's https://YOURDOMAIN/api/auth/callback/google; set NEXTAUTH_URL/AUTH_URL to your production URL.
- Wait a few minutes for Google to propagate the change.
Fix prompt (paste into Lovable, Bolt, Cursor, Replit or v0)
Google sign-in fails with redirect_uri_mismatch in production. Find where the OAuth callback URL is built, make it use the production base URL from an env var, tell me the exact redirect URI to add in Google Cloud Console, and list the env vars (e.g. AUTH_URL/NEXTAUTH_URL) to set on the host.
Error codes this fixes
Error 400: redirect_uri_mismatch(Google OAuth)
FAQ
Does http vs https matter?
Yes, the URI must match exactly, including scheme and trailing slash.
Can I use wildcards?
No, Google requires exact redirect URIs.
Sources
Based on the official documentation:
Related fixes
- Better Auth security release (Nov 2026): upgrade to 1.7.16 to stop Expo account takeover
- Magic link / OAuth login redirects to localhost:3000
- User is logged out after page refresh
- Supabase confirmation, magic link or password reset emails not sending
Want the full checklist for this area? Get a Fix Kit ($29)
Featured slot available: reach thousands of vibe coders. Sponsor this week →
Get one new fix a week
Free newsletter: the newest breakages in Lovable, Bolt, Cursor, Replit and v0 apps, with paste-in fixes.
We only use your email to send the newsletter. Unsubscribe any time. See privacy.