Guide
v0 with Supabase: sign-in sends people to the wrong URL (preview vs production)
Short answer: Supabase sends people to whatever is in your Site URL when the code does not pass a redirectTo, and v0 gives every working branch its own Vercel preview URL. Set the Site URL to your production address, add the Vercel preview wildcard to Redirect URLs, and pass redirectTo from NEXT_PUBLIC_SITE_URL.
Why it happens
v0 deploys projects to Vercel. Working branches get preview deployments with unique URLs, and publishing updates the Vercel project's production deployment and stable production URL. So the same app answers on more than one address.
On the Supabase side, the Site URL in URL Configuration defines the default redirect URL when no redirectTo is specified in the code. Supabase's own note says this setting is critical for email confirmations and password resets. If it still points at a local address, people who sign in from your live app get sent there.
Supabase also expects the redirectTo address to match your Redirect URLs list. Vercel preview URLs are not on that list unless you add them.
How to fix it
- In Supabase, open the URL Configuration page and set the Site URL to your production URL (for example
https://example.com). Supabase says to change this fromhttp://localhost:3000to your production URL. - On the same page, add your local and preview addresses to Redirect URLs. For Vercel, Supabase lists these two:
http://localhost:3000/**https://*-<team-or-account-slug>.vercel.app/**
- In v0, open
Project menu ... → Settings → Environment Variablesand setNEXT_PUBLIC_SITE_URLto your site URL in the production environment. Supabase says this should be set to your site URL in production to ensure redirects function correctly. - In your sign-in code, build the redirect target from
NEXT_PUBLIC_SITE_URLfirst, thenNEXT_PUBLIC_VERCEL_URL, thenhttp://localhost:3000/. Supabase provides this order and notesNEXT_PUBLIC_VERCEL_URLis set automatically by Vercel. - Make sure the URL starts with
https://when it is not localhost, and ends with a trailing/. Supabase's example does both. - Pass that value as
redirectToin the sign-in call, for exampleoptions: { redirectTo: getURL() }onsupabase.auth.signInWithOAuth. - If you use email templates together with
redirectTo, you may need to replace{{ .SiteURL }}with{{ .RedirectTo }}in the confirmation link, as Supabase describes in its Email Templates guide. - In v0, open
Project menu ... → Settings → Domainsand confirm the domain belongs to the connected Vercel project. Unverified domains must be verified in Vercel before you can select them. - Publish again: open
Publish, review the production deployment and selected domain, then selectPublish Changes.
How to check it worked on your live app
Open a private window and use a fresh email address you have not signed up with before. Go to your production URL, not a preview URL. Do the failing action: sign in, or request a confirmation email. Watch the address bar after the redirect. It should land on your production domain, not a preview URL and not localhost. Then repeat once from a preview deployment to confirm the wildcard entry covers it.
Prompt to paste into your AI builder
Paste this into your AI builder: "My Supabase sign-in sends people to the wrong URL. Please add a getURL() helper that reads NEXT_PUBLIC_SITE_URL first, then NEXT_PUBLIC_VERCEL_URL, then falls back to http://localhost:3000/, adds https:// when the value is not localhost, and adds a trailing /. Use it as redirectTo in the Supabase sign-in call. Also tell me exactly which value to put in NEXT_PUBLIC_SITE_URL under Project menu → Settings → Environment Variables for production. Show me the change first before applying it."
FAQ
Why does the preview work but production send people elsewhere? Preview deployments have unique URLs and do not change the project's production URL. If your code does not pass redirectTo, Supabase falls back to the Site URL, which may not match the address the person is on.
Do I need a wildcard in Supabase? Only for preview and local addresses. Supabase recommends setting the exact redirect URL path for your site URL in production, and using the globstar ** for local development and preview URLs.
Where do I change the production address in v0? Open Project menu ... → Settings → Domains. Advanced DNS configuration, redirects and other domain settings open in the Vercel dashboard.
What if the domain I want is missing from the list? Open Project menu ... → Settings → Domains and confirm the domain belongs to the connected Vercel project. Unverified domains must be verified in Vercel before you can select them.
Related guides
- Sign-up or login broken after publishing (Supabase redirect URLs) — the same redirect list, walked through for a published app.
- The confirmation link in my sign-up email opens localhost: why, and the fix — when the Site URL is still the local address.
- Works in the preview, breaks after deploy: the 4 differences that cause it — why preview and production behave differently.
Sources
VibeFix's check can show this on your live app: its AI agent signs up to your app like a new person, uses it on a phone and a computer, and shows what breaks. VibeFix checks; it does not fix your app.
Last checked: 19 October 2026, against the sources listed above.
VibeFix is independent. Lovable, Bolt, Replit, Base44, v0 and Supabase are trademarks of their owners.
Still stuck?
Paste your app’s link for a free sign-up check, no account needed. An AI agent signs up to your live app as a brand-new person, on a phone and a computer, and tells you whether a new person can finish.