Mendlark / Guides

Google sign-in "Error 400: redirect_uri_mismatch" after deploy: how to fix it

Google sign-in worked in preview. On your live site, users land on a Google page saying Access blocked: This app's request is invalid with Error 400: redirect_uri_mismatch. Google only sends users back to callback URLs you've listed exactly. One character off (http vs https, www, a trailing slash) and it refuses.

1. Find the exact URL Google rejected

On the error page, click error details. You'll see redirect_uri=…. Copy that value exactly. That's the URL Google needs to have on its list.

2. Using Supabase Auth? The callback is Supabase's, not yours

With Supabase, Google redirects to https://<project-ref>.supabase.co/auth/v1/callback, then Supabase sends the user on to your app. In Google Cloud Console → APIs & Services → Credentials → your OAuth client, add under Authorized redirect URIs:

https://<project-ref>.supabase.co/auth/v1/callback

Using a Supabase custom domain? Add that callback too (for example https://auth.yourapp.com/auth/v1/callback).

3. Add your live domain to Authorized JavaScript origins

In the same OAuth client, list https://yourapp.com and https://www.yourapp.com if you use both. No paths, no trailing slash.

4. Fix the second hop in Supabase

If Google now succeeds but you land on localhost or the preview URL, Supabase is sending you to the wrong place. In Authentication → URL Configuration, set Site URL to your live domain and add https://yourapp.com/** to Redirect URLs. In code, pass it explicitly:

await supabase.auth.signInWithOAuth({
  provider: 'google',
  options: { redirectTo: `${window.location.origin}/auth/callback` }
})

5. Check the consent screen is published

If the OAuth app is still in Testing, only listed test users can sign in and everyone else sees "access blocked". Under OAuth consent screen, publish it to production. Changes to redirect URIs can take a few minutes to apply.

Quick checklist

  • Exact redirect_uri from the error details is in Google's list
  • Supabase /auth/v1/callback URL added (not your app URL)
  • Live domain (https, www and non-www) in JavaScript origins
  • Supabase Site URL and Redirect URLs point to the live domain
  • Consent screen published, not in Testing

Still stuck?

Mendlark fixes this kind of problem for a fixed €49 (launch price, normally €79). We agree the problem first, test the fix and send it as a pull request, so nothing changes in your app until you merge it. If we can't fix it, you don't pay. Get the €49 fix, or start with a free scan.

Not sure what else is wrong? Paste your app link into the free instant check and get a plain-English list of problems in seconds.