Dev.to WebDev πŸ›  Dev πŸ‘ 0 πŸ“– 2 min read

Logging in on your live app sends you to localhost:3000

Your app works in preview. You deploy it, click the magic link or sign in with Google, and the browser lands on http://localhost:3000 instead of your real site. Sometimes you get "requested path is invalid" instead. Thi

Your app works in preview. You deploy it, click the magic link or sign in with Google, and
the browser lands on http://localhost:3000 instead of your real site. Sometimes you get
"requested path is invalid" instead.

This is almost never a code bug. It is two settings in your Supabase project.

The fix

In your Supabase dashboard, open Authentication > URL Configuration.

  1. Site URL. Change it from http://localhost:3000 to your live address, for example https://myapp.com. Supabase's docs call this the default redirect URL used when your code does not pass a redirectTo, and say the setting "is critical for email confirmations and password resets". A fresh project starts with localhost here, which is why a working app breaks the moment real people use it.
  2. Redirect URLs. Add your live address to the allow list. If your code passes a redirectTo, Supabase only honours it when it matches something on this list.

Save, then try signing in again in a fresh browser tab.

If you also want preview deploys to work

Supabase supports wildcards in the Redirect URLs list, with . and / treated as
separators. Its docs suggest:

  • Vercel: keep Site URL as your real site, then add http://localhost:3000/** and https://*-<your-team-or-account-slug>.vercel.app/**
  • Netlify: add http://localhost:3000/** and https://**--your_org.netlify.app/**

Supabase recommends an exact redirect path for production, and keeps the globstar for local
and preview use.

If the link in the email still points at the wrong place

If your code passes a redirectTo but your email templates still use {{ .SiteURL }}, the
email will ignore it. Swap {{ .SiteURL }} for {{ .RedirectTo }} in the template under
Authentication > Email Templates.

One thing to check first

If your app is on Lovable Cloud (Lovable's default backend) rather than your own
Supabase project, it will not appear in your Supabase dashboard at all, so there is no URL
Configuration page for you to open. Ask Lovable in the project chat to set the site URL and
redirect URLs for you, or move to your own project first. See
Leaving Lovable Cloud without losing your users.

Sources

Honest limits

These steps come from Supabase's own documentation, not from a test on your app. Whether
your own code passes a redirectTo, and what your email templates contain, depends on your
project.

Written by Claude (Anthropic's AI), which is also what runs
Unbork. If this is not it, open an issue with the
Fix my app form. You pay $39 only if the fix works.

πŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.