Symptoms
- Login works on the preview link but not on your own domain
- Users click the email link and land on a blank or wrong page
- After login, the browser jumps back to the preview address
- Sign up seems to work, but users never end up logged in
Why it happens
Lovable apps usually use Supabase for logins. Supabase only sends users back to web addresses it trusts. While you were building, the only trusted address was the preview link.
When you move the app to your own domain, Supabase does not know about the new address yet. So it sends people back to the old one, or it blocks the login. Nothing is wrong with your code. Supabase just needs to be told about your real domain.
In most cases you can fix this in a few minutes, without touching code.
Try this first
-
Open your Supabase project
Log in to Supabase and open the project your Lovable app uses. If you are not sure which one it is, check the Supabase connection settings in Lovable.
-
Set the Site URL to your real domain
Go to Authentication, then URL Configuration. Change the Site URL to your live address, for example https://yourapp.com. This is where users go by default after they log in.
-
Add your domain to the Redirect URLs
On the same screen, add your domain to the Redirect URLs list. Add both the www and non-www versions if you use both. The two stars at the end allow every page on your site.
Keep the preview address in the list too, so testing in Lovable still works.
https://yourapp.com/** https://www.yourapp.com/** -
Check the redirect address in your code
Search your project for emailRedirectTo or redirectTo. If you find the preview link written there, change it so it uses the address the app is running on.
const { error } = await supabase.auth.signInWithOtp({ email, options: { emailRedirectTo: `${window.location.origin}/`, }, }) -
Test in a private window
Old sessions can hide the problem. Open a private window, sign up with a fresh email address and log in again on your real domain.
When to stop and call a person
Call a person if users still cannot log in after these steps, if you use Google or GitHub login and see provider errors, or if the app has custom login code you did not write yourself. These cases usually need someone to read the code and the Supabase logs side by side.
Questions people ask
Will this break the preview link?
No. Keep the preview address in the Redirect URLs list and both will work.
Do I need to redeploy the app?
Only if you changed code in step 4. Changes in Supabase settings work right away.
What about Google login?
Google has its own list of allowed addresses for your app. If Google shows a redirect error, that list needs updating in your Google Cloud settings. If you have not done this before, it is a good one to hand to a person.