---
title: "After login, my app sends users to localhost"
description: "Logins bouncing to localhost:3000 come from one Supabase setting and one allow-list. Here's exactly where they are and how to fix both in minutes."
url: https://www.fomio.ai/blog/after-login-my-app-sends-users-to-localhost
published: 2026-10-31T19:00:00.565+00:00
updated: 2026-10-31T19:00:00.565+00:00
topic: supabase
words: 1560
---

# After login, my app sends users to localhost

One setting your project was born with is quietly redirecting every sign-in to an address only your laptop can reach.

**In short:**

- A brand-new Supabase project starts with its sign-in address set to http://localhost:3000, and nothing in an AI builder's flow asks you to change it.
- There are two causes with identical symptoms: the default address, and an address your app asks for that isn't on the trusted list.
- Google and GitHub sign-in add a third list, in Google's console, and the address there is Supabase's — not your domain.
- The only test that counts is logging out, opening a private window, and signing up as a stranger.

### Why does my app redirect to localhost after login?

Because Supabase sends people to the address in its Site URL field after sign-in, and new projects ship with that set to http://localhost:3000. That address only exists on a developer's own computer. Change it in your Supabase dashboard under Authentication, URL Configuration, to the address real people type.

Someone signs in. The page thinks for a second. Then the browser lands on localhost:3000 and says it can't connect, or just sits there white.

Nothing is broken in your app. Nothing is broken in your database. One setting, in one screen, is still holding the value it had the day your project was created — and every login is obediently following it.

## Which setting decides where people land after login?

Supabase handles the sign-in. When it's done, it has to send the person's browser somewhere, so it needs an address. That address comes from a field called **Site URL**, in your Supabase dashboard under Authentication → URL Configuration.

Supabase's own documentation describes it as the default address people get sent to when your code doesn't name one, and tells you in plain terms to change it from http://localhost:3000 to your real address.[^1]

They have to say that because every new project starts with that value. It's the address a computer uses to talk to itself while someone builds. On your laptop it works. In the world, it's a door that opens onto nothing.

If you built with Lovable, Bolt, Replit or v0, you almost certainly never saw that field. The tool created the project, the field got its default, and nothing in the build flow asked you to touch it. This is a default that outlived the moment it made sense in.

## Why did changing Site URL not fix it?

Because there is a second cause that looks identical from outside. Your app can ask Supabase to send someone to a specific address after login — code written by an AI tool often does exactly that — but Supabase won't use an address it hasn't been told to trust.

That trusted list sits in the same screen, called **Redirect URLs**. If the address your app asks for isn't on it, Supabase refuses and falls back to Site URL. Which, if nobody changed it, is localhost again.[^1]

- Site URL is still the factory default, or
- your app is asking for a real address that isn't on the trusted list, and Supabase is quietly falling back to the default.

That's why people fix one, test, and watch it still fail. They fixed half of it.

## Is this a new bug or has it always done this?

It has always done this, and that's the good news. A Supabase community discussion opened in March 2022 describes the exact behaviour — magic link login landing on localhost:3000, with Site URL as the place you change it.[^2]

It shows up constantly in the AI-builder world specifically. A write-up by Ishwar Rimal walks through a Lovable and Supabase project where Google sign-in worked locally but bounced to localhost once shared, with Site URL as the culprit.[^3] A case study documenting that same write-up calls the pattern a repeat visitor in Lovable community threads.[^4] Guides for Lovable builders list the untouched default as a frequent cause.[^5]

## How do I fix the localhost redirect?

1. **Open the right screen** — In your Supabase dashboard, pick the project your app uses, then go to Authentication → URL Configuration.
2. **Set Site URL to your real address** — The full thing, including https://, with no trailing slash. If you have a custom domain, use that — not the preview address your builder gave you, because preview addresses change and then you're back here.
3. **Add every other address to the trusted list** — Your custom domain, the version with and without www if both work, your builder's preview address if you still test there, and http://localhost:3000 if anyone runs the app locally. Keeping localhost on the list is fine; it's only harmful as the default.
4. **If you use Google or GitHub sign-in, check the third list** — In the Google Cloud console, the address you authorise is the Supabase callback shown on Supabase's own Providers screen — not your app's address. Google hands the person back to Supabase, then Supabase hands them to you. Guides for Lovable builders flag this specifically, because putting your own domain there feels right and doesn't work.[^5]
5. **Test as a stranger** — Not on the tab you're already logged into. Log out, open a private window, sign up fresh, and click the email link. Test the signup and password reset emails too — those links are built from the same setting.

> **About wildcards** — Supabase supports a wildcard character in the trusted list so you can cover a family of preview addresses at once, but its documentation recommends exact addresses for your live site instead.[^1] Take that advice. A narrow list is a list you can reason about at 11pm.

## Why did nothing warn me this was broken?

Because your app never went down. The homepage loaded. The database answered. The only broken thing was the one path you personally stopped walking the day you launched: signing up as a new person.

That's the shape of most breaks in apps built this way. Not an outage. A door that quietly stopped opening, for people who never tell you.

I'll be straight about the limits here. Fomio, which I work on, watches an app from outside — you paste a link, it checks every minute and says **Working**, **Having trouble** or **Down**. A watcher looking from outside sees a healthy homepage while your login sends people to localhost. For this particular break, the steps above are the whole answer and you don't need us.

Where it earns its place is the day after. Redeploys, settings changed in a hurry, a domain switch — the session where you fix one thing is the session where something else moves. The free plan watches one app, checks every five minutes, emails you when it breaks and keeps a week of history, with no card. The Builder plan watches three, checks every minute, keeps thirty days, and writes a prompt you can paste straight into the tool you built with. Current prices are at fomio.ai/pricing.

**Paste this into your AI tool**

```text
My app uses Supabase for sign-in. I've set the Site URL and the trusted redirect list in the Supabase dashboard to my live domain. Find anywhere in my code that passes a redirect address after login, signup or password reset, and make sure it uses my live domain rather than a hardcoded localhost address. List every file you changed.
```

## What should I do right now?

1. Supabase dashboard → Authentication → URL Configuration. Change Site URL from localhost:3000 to your real address.
2. Add your real addresses to the trusted redirect list below it.
3. If you use Google or GitHub sign-in, confirm the address authorised in Google's console is the Supabase callback, not your own domain.
4. Log out, open a private window, sign up as a new person, and click the email link.

Four steps, no code, and the setting that caused it has been sitting there untouched since the day the project was made. It was never your fault. It just needed somebody to look at it.

## Questions people also ask


### Can I leave localhost in the trusted list?

Yes. Keeping http://localhost:3000 on the trusted redirect list is fine and useful if you or anyone else still runs the app on their own machine for testing. The problem was never that localhost appeared somewhere — it's that it was the default fallback address, so everyone got sent there. Once Site URL points at your live domain, localhost sitting in the list below causes no harm to real visitors.

### Should I use my builder's preview address or my custom domain?

Use your custom domain as the Site URL, and add the preview address to the trusted list underneath. Preview addresses from AI builders can change when you redeploy or rename a project, and when they change you end up back at a broken login with no obvious reason why. The custom domain is the address real people type, so it's the one that should decide where sign-ins land.

### Why does Google sign-in need a different address?

Because Google doesn't hand the person back to your app — it hands them back to Supabase, which then sends them on to you. So the address you authorise in the Google Cloud console is the Supabase callback address shown on Supabase's own Providers screen. Putting your own domain there feels correct and doesn't work. Guides written for Lovable builders call this out specifically because so many people get caught by it.

### Will password reset and signup emails fix themselves too?

They're built from the same setting, so changing Site URL fixes them at the same time — but test them anyway. Send yourself a fresh signup email and a fresh password reset from a private window and click both links. Old emails already in an inbox still carry the old address and will keep failing, which is a confusing thing to discover while you're trying to work out whether your fix worked.


## Sources

[^1]: Redirect URLs — Supabase Docs. https://supabase.com/docs/guides/auth/redirect-urls
[^2]: Auth redirect and Additional Redirect URLs · Discussion #6088 — Supabase (GitHub Discussions) (2022-03-26). https://github.com/orgs/supabase/discussions/6088
[^3]: Fixing the "logIn with Google" issue in lovable with Supabase integration — Ishwar Rimal, Medium. https://ishwar-rimal.medium.com/fixing-the-login-with-google-issue-in-lovable-with-supabase-integration-a005cc974ef9
[^4]: Documented: Lovable Google Login Redirects to localhost:3000 — michaelbir.es case studies. https://www.michaelbir.es/case-studies/lovable-google-login-custom-domain/
[^5]: Adding OAuth Providers (Google, GitHub) in Lovable Auth Flow — Rapid Developers. https://www.rapidevelopers.com/lovable-issues/adding-oauth-providers-google-github-in-lovable-auth-flow
[^6]: Lovable login works in preview, breaks in production: the 3 redirect lists — DEV Community. https://dev.to/fixloopdev/lovable-login-works-in-preview-breaks-in-production-the-3-redirect-lists-4ip0
