You added "Sign in with Google" to your app. Clicking it shows:

Error 400: redirect_uri_mismatch

or you sign in and land on localhost, or on the wrong page.

Why it happens

The OAuth provider only sends users back to addresses you pre-registered. Any difference, even a trailing slash, fails.

  1. Production URL not registered. You added http://localhost:3000 in the Google console but not your live domain.
  2. http vs https. The registered value and the real one differ.
  3. Wrong callback path. With Supabase, the Google console needs Supabase's callback URL (https://<project>.supabase.co/auth/v1/callback), not your app's URL.
  4. Supabase Site URL still set to localhost. Auth redirects fall back to the Site URL. Set it to your live domain in Authentication, URL Configuration.
  5. Redirect URL not on the allow list. Add your live domain and preview domains to the allowed redirect URLs.
  6. Preview domains. Every Vercel or Netlify preview has a new hostname that is not registered.

The unsafe fix

The quick fix for cause 6 is a wildcard like https://* or * in the allowed redirect URLs. An open redirect list lets an attacker craft a sign-in link that sends the user, with the auth token, to a site the attacker controls. Allow your exact domains, and a narrow wildcard only for your own preview pattern.

Also avoid:

  • Putting the OAuth client secret in front-end code. The secret belongs on the server or in the provider's dashboard.
  • Leaving the localhost URL in production settings forever. Keep dev and prod as separate OAuth clients.

The safe pattern

  1. List exact URLs: local, production, and your preview pattern.
  2. Register the provider callback in the provider console, and your app URLs in the auth service allow list.
  3. Test the full sign in on the live domain with a fresh private window.

An outside view

ProofForge at proofforge.live runs a free public-side scan of AI-built apps. It never signs in, so it cannot test your sign-in flow, and it will not tell you your redirect list is correct. It can show what is exposed to a visitor before login, such as secret-shaped strings in your bundle.