Lovable login works in preview but not on the published site (or sends users to localhost)
Updated First published
On this page (4)
Symptom
Signing in works in the Lovable preview, but on the published lovable.app link or your custom domain it fails, sends people back to the wrong page, or Google shows a redirect URI mismatch error. Or the link in a confirmation or password reset email opens localhost instead of your app.
Cause
This page is only about signing in: the login, sign-up, Google button, email confirmation or password reset. If the whole published app is blank, broken or empty, start with Lovable preview works, published app doesn’t. If the published app shows an older version of your changes, see The published link doesn’t show my latest changes.
The facts below come from Lovable’s docs on authentication and Google sign-in, and from Supabase’s docs on redirect URLs, checked October 19, 2026. Menu paths in Lovable were updated on October 28, 2026, from Lovable’s editor docs (section “The More menu”) and changelog, after the redesigned More menu.
Why it happens: two addresses your sign-in needs
After someone signs in, your app sends them back to an address. For safety, it won’t send them just anywhere. Two settings decide where:
- Site URL: the default address people are sent to after signing in, when the app doesn’t name one. Supabase’s docs say it’s critical for email confirmations and password resets.
- Redirect URLs: the list of addresses sign-in is allowed to send people back to. Lovable’s docs say you can have up to 50.
Your published app has its own address, ending in lovable.app, and a custom domain is another one. If the address people are on isn’t allowed, sign-in fails or sends them somewhere else. Lovable’s docs put it simply: if sign-in works in preview but breaks on your published app or custom domain, these addresses are usually the reason.
First, find out which backend your app uses
The fix depends on where your app’s sign-in lives.
- Lovable Cloud (the built-in backend). This is the default. If you never connected your own Supabase account to the project, your app is on Cloud. Lovable keeps both settings up to date for you: when you publish, it sets the Site URL to your published lovable.app address, and when you connect a custom domain, it adds that domain to the redirect URLs. One exception: a Site URL you set yourself stays unchanged.
- Your own Supabase project. If you connected a Supabase project you own, Lovable’s docs say nothing updates automatically. You add the addresses yourself, in that Supabase project’s settings.
If you’re on Lovable Cloud
Lovable usually handles this when you publish. If sign-in still fails:
- Ask Lovable in the project chat to add your published address and custom domain to the auth redirect URLs. The prompt on this page does that and asks it to change nothing else.
- Or do it yourself: open More → Users → Auth settings, then Advanced, and check the Site URL and the Redirect URLs.
- If you ever typed a Site URL yourself, check it. Lovable doesn’t overwrite it, so it may still point to an old address.
If you use your own Supabase project
- Open your project in the Supabase dashboard and go to the URL Configuration page.
- Look at the Site URL. If it says http://localhost:3000, change it to your real address, like https://YOUR-APP.lovable.app or https://yourdomain.com. Supabase’s docs say to change it from localhost to your production address, and that this setting is critical for email confirmations and password resets.
- Add your published address and your custom domain to the Redirect URLs.
About wildcards. Supabase lets you use patterns like ** in redirect URLs, which match many addresses at once. Its docs say this is useful for local development and preview addresses, but recommend the exact address for your production site. So add your real addresses one by one.
The “it sends people to localhost” symptom
If someone signs up and the confirmation email, or the password reset email, opens a page starting with localhost, the Site URL was never changed from http://localhost:3000, which isn’t your live site. Change the Site URL as described above, then test again with a new sign-up or password reset.
A related clue: Supabase’s docs say that when sign-in fails, the person is still sent to the address, and the error details show up in the address bar, after a #. If you see something like error_code or error_description there, sign-in itself failed.
If you use Google sign-in
Lovable’s Google sign-in works in two ways, and it’s set in More → Users → Auth settings → Google:
- Managed by Lovable: the default, and what Lovable recommends. Lovable handles the Google setup, and connecting a custom domain needs no change.
- Your own credentials: you created the sign-in setup in your own Google Cloud project. Then every address you use must also be added in Google Cloud Console as an Authorized redirect URI. Lovable’s docs say these must match exactly:
httpsvshttp, the domain, the path and even a trailing slash all matter.
When you connect a custom domain with your own credentials, Lovable adds a redirect URL for it to the list in that Google settings screen, but doesn’t select it. Add the URL in Google Cloud Console, then come back, select it in Lovable and click Save. Until you do, Google sign-in fails on the new domain with a redirect URI mismatch error.
Step-by-step check
- Open your published address in a private (incognito) window and try to sign in. Write down what happens and copy any error.
- Check whether your app is on Lovable Cloud or your own Supabase project.
- Check the Site URL: it should be your real address, not localhost and not an old address.
- Check that your published lovable.app address and your custom domain are in the redirect URLs.
- If you use Google sign-in with your own credentials, check the Authorized redirect URIs in Google Cloud Console, character by character.
- Try signing in again on the published address, in a new private window.
Prompt to paste
Copy the text below, replace what’s in brackets and send it in the chat of the tool you’re using.
Sign-in works in the preview but not on my published app.
My published address: https://YOUR-APP.lovable.app (replace with your real address)
My custom domain, if I have one: https://yourdomain.com (replace with your real domain, or delete this line)
Check this app's auth Site URL and redirect URLs.
Make sure the published lovable.app address and my custom domain are in the redirect URLs, and tell me if the Site URL should point to one of them.
Then tell me in plain English what you found and exactly what you changed.
Don't change the app's code or anything else.How not to burn credits
- This is a settings problem, not a code problem. Don't ask Lovable to rebuild the login page or the sign-in flow. That costs credits and doesn't touch the setting that's wrong.
- Send one prompt to check and fix the addresses, like the one on this page, and read what Lovable says it changed before sending anything else.
- If your app uses your own Supabase project, you can fix it yourself for free in Supabase's URL Configuration page, without asking Lovable at all.
- Test sign-in on the published address in a private (incognito) window, not in the preview. The preview already works, so it can't tell you if the fix worked.
How Lovable counts credits, and what the free plan includes: Lovable credits explained.
Questions people ask
Why does sign-in work in the Lovable preview but not on my published app?
Lovable's docs say the usual reason is that the published address or custom domain is missing from your project's redirect URLs, the list of addresses sign-in is allowed to send people back to. On Lovable Cloud, Lovable adds these when you publish and when you connect a custom domain. If it still fails, or you use your own Supabase project, add your address to the redirect URLs.
Why does the confirmation or password reset email send people to localhost?
The Site URL is still set to http://localhost:3000. The Site URL is the default address people are sent to when the app doesn't name one, and Supabase's docs say it matters most for email confirmations and password resets. Change it to your production address, for example your lovable.app link or your own domain.
Where do I change the Site URL and redirect URLs?
On Lovable Cloud, they're under More → Users → Auth settings → Advanced, or you can ask Lovable in the project chat to update them. If your app uses your own Supabase project, change them in that project's URL Configuration page in Supabase.
Google sign-in fails on my custom domain with a redirect URI mismatch. What do I do?
If you use your own Google credentials, add the new domain's redirect URL as an Authorized redirect URI in Google Cloud Console, written exactly as Lovable shows it, then select it in More → Users → Auth settings → Google and click Save. If you use Managed by Lovable, connecting a domain needs no change there.
Can I just allow every address with a wildcard?
Supabase allows wildcards like ** in redirect URLs and suggests them for local development and preview addresses. For your real, production site, its docs recommend the exact address instead.
New guides by email. An email when we publish a new guide, error fix or chapter, in plain English. Subscribe