Supabase Auth Redirects to Localhost

Workaround available Web, server (all SDKs) Updated October 21, 2026

Quick answer

Supabase falls back to the Site URL when redirectTo isn't in the allowlist. Set the Site URL to your production domain and add every app URL to Redirect URLs.

Most likely fix: Set the Site URL.

Symptoms

After Google/GitHub login, magic link or email confirmation, users land on http://localhost:3000 or the wrong domain.

Why it happens

  • Site URL still set to localhost
  • redirectTo URL not in the Redirect URLs allowlist (exact match)
  • Preview/staging domain missing
  • Trailing slash mismatch

How to fix it

Try these in order — the most common fix is first.

  1. 1. Set the Site URL

    1. Dashboard > Authentication > URL Configuration
    2. Set Site URL to https://yourdomain.com (no trailing slash)
  2. 2. Add Redirect URLs

    1. Add production, preview and localhost URLs
    2. Use wildcards for preview deployments, e.g. https://*-yourteam.vercel.app/**
  3. 3. Pass redirectTo explicitly

    1. In signInWithOAuth / signInWithOtp pass options.redirectTo with the current origin
  4. 4. Check the OAuth provider callback

    1. In Google/GitHub console the redirect URI must be https://<project>.supabase.co/auth/v1/callback

This guide also covers

  • supabase redirect to localhost
  • supabase oauth redirect wrong url
  • supabase redirectTo not working
  • supabase google login redirect

Still not working?

If Supabase keeps failing, you're not alone. See every Supabase problem users report or the alternatives people switch to.

Other Supabase errors