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. Set the Site URL
- Dashboard > Authentication > URL Configuration
- Set Site URL to https://yourdomain.com (no trailing slash)
2. Add Redirect URLs
- Add production, preview and localhost URLs
- Use wildcards for preview deployments, e.g. https://*-yourteam.vercel.app/**
3. Pass redirectTo explicitly
- In signInWithOAuth / signInWithOtp pass options.redirectTo with the current origin
4. Check the OAuth provider callback
- 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
- Supabase Project Paused
- Supabase Max Client Connections Reached
- Supabase 'New Row Violates Row-Level Security Policy' Error
- Supabase Confirmation Email Not Sending
- Supabase 'Invalid Refresh Token: Refresh Token Not Found'
- Supabase Edge Function 546 WORKER_LIMIT Error
- Supabase Storage Upload Failed
- Supabase 'Canceling Statement Due to Statement Timeout'
- Supabase Realtime Not Working
- Supabase Database Connection 'Network Is Unreachable'
- Supabase Start Not Working (Docker Container Unhealthy)