Lovable·Fixauthbeginner

Lovable Login Works in Preview but Fails on the Live URL

Quick Answer

How do I fix Lovable Login Works in Preview but Fails on the Live URL?

Supabase auth redirect URLs are set to localhost by default. After deploying to Vercel, the redirect URL must be updated in Supabase settings. Start with "Open Supabase auth settings" before making broader code changes.

Fix signals

What this answers
Why lovable login works in preview but fails on the live url happens and what to change first.
Fastest move
Open Supabase auth settings
Use this page if
Login works in preview but fails on the live URL

If this keeps happening

Open the next decision, not just the patch

Use these when the current fix is helpful, but the real answer is a better tool choice, a cleaner workflow layer, or a more trustworthy launch path.

Quick Fix Summary

Most likely causeSupabase auth redirect URLs are set to localhost by default. After deploying to Vercel, the redirect URL must be updated in Supabase settings.
Fastest fixOpen Supabase auth settings
Use this page ifLogin works in preview but fails on the live URL

Exact errors people search for

If one of these matches what you are seeing, you are likely on the right fix page.

Login works in preview but fails on the live URL
Lovable auth works in preview but breaks after deploy
Redirect after login goes to localhost or the wrong URL
Email confirmation link sends users to localhost or the wrong domain

You're in the right place if...

  • !Login works in preview but fails on the live URL
  • !Redirect after login goes to localhost or the wrong domain
  • !Email confirmation link works but users never land back in the app

Why this happens

Supabase auth redirect URLs are set to localhost by default. After deploying to Vercel, the redirect URL must be updated in Supabase settings.

Fix

1

Open Supabase auth settings

Go to Supabase Dashboard → Authentication → URL Configuration

2

Update redirect URLs

Replace the localhost URLs with your production domain:

Site URL: https://your-domain.com

Redirect URLs (add all of these):
https://your-domain.com/**
https://your-app.vercel.app/**
3

Redeploy on Vercel

After updating Supabase settings, redeploy your app on Vercel to ensure the changes take effect.

Prevent this next time

Add your production domain to Supabase redirect URLs BEFORE your first deploy. This prevents login issues from day one.

Frequently Asked Questions

Preview uses localhost URLs. Production needs your actual domain added to Supabase's allowed redirect URLs.

Add both your-domain.com/** and your-app.vercel.app/** to handle both URLs.

Related fixes