When login works in the preview but not on your domain
Sign-in sends people to the old address or shows a redirect error? Add your domain to Supabase, Firebase, Clerk or Google, and fix the code with one prompt.
Troubleshooting4 min read
Why the login breaks
Your app's login is run by a sign-in service, such as Supabase, Lovable Cloud, Clerk, Firebase or Google. For safety, that service keeps a list of web addresses it's allowed to send people back to after they sign in. Your app was built on the builder's address (lovable.app, bolt.host, localhost…), so that's the address on the list. Your own domain isn't, so the service refuses it, or sends people back to the old address.
The fix is usually two small changes: add your domain to the sign-in service's list, and make sure your code doesn't have the old address written into it. Neither needs you to move your database or your users.
How to recognise it
- Signing in on your domain sends you back to the builder's address, or to
localhost. - An error such as redirect URL not allowed, Invalid redirect or Google's redirect_uri_mismatch.
- The sign-up or password-reset email opens the old address instead of your domain.
- Sign-in works in the builder's preview, and only fails on your domain.
Step 1: add your domain to the sign-in service
Do this in the sign-in service's own dashboard. Replace yourdomain.com with your domain, and add both the address with www and without it if your site answers on both.
| Sign-in service | Where | What to add |
|---|---|---|
| Supabase | Authentication → URL Configuration | Set Site URL to https://yourdomain.com. Under Redirect URLs, add https://yourdomain.com/**. |
| Lovable Cloud | In Lovable: More → Cloud → Users → Auth settings → Advanced | The same two settings as Supabase: your domain as the Site URL, and in Redirect URLs. |
| Firebase | Authentication → Settings → Authorized domains | Add yourdomain.com. |
| Clerk | Domains in the Clerk dashboard | Add your domain. A production instance also asks for DNS records: add them where you manage your domain. |
| Google sign-in with your own credentials | Google Cloud Console: APIs & Services → Credentials → your OAuth client | Add https://yourdomain.com to Authorized JavaScript origins, and your app's callback address on your domain to Authorized redirect URIs. |
Step 2: remove the old address from your code
AI tools often write the preview address straight into the code, for example in the link a sign-up email sends people to. Paste this into your AI tool (Lovable, Bolt, Cursor, Claude Code…), with your domain filled in:
My app now runs on https://yourdomain.com.
Find every place in the code that uses a fixed web address
for sign-in, sign-up, password reset, email confirmation or
login callbacks (for example emailRedirectTo, redirectTo,
callbackUrl, or any lovable.app, bolt.host, vercel.app or
localhost address) and change it to use the address the site
is currently open on (window.location.origin).
Don't change anything else, and list the files you changed.Then publish the new version: in ProHostiva, upload the new ZIP or publish again from GitHub.
VITE_), they also need to be in your site's Secret settings in ProHostiva. They're built into the page, so publish again after adding them.Step 3: check that it works
Open your domain in a private window
A private window has no old sign-in saved, so you see what a new visitor sees.
Sign in, or sign up with a test email
You should land back on your domain, signed in.
Try the emails
Ask for a password reset. The link in the email should open your domain, not the old address.
Still not working?
- Run the free check on your project: it shows the problems that only appear once a site is public.
- Uploaded a ZIP? Email us and we'll fix the code ourselves and send you the updated ZIP.
- Publishing from GitHub? We never change code in your repository. Email us what you see, and we'll write the exact instruction for your AI tool, then check again once you've published.
- If we can't get your app working within 7 days of your first payment, you get that payment back: see the Terms, section 10.