shipfix

Common errors · Supabase Auth with Lovable, Bolt, Next.js, Vite

Supabase auth: confirmation or magic link redirects to localhost:3000

Cause Site URL in Supabase is still localhost, or your real domain is missing from the Redirect URLs allow list.
Fix Set Site URL to the production domain, add every domain to Redirect URLs, and pass the redirect built from the current origin.

This site can't be reached: localhost refused to connect (after clicking the email link)

Have it fixed for you, 290 EURSee the fix step by step

What you receive a diff on a branch of your repository, and a correction note: root cause, change made, how to verify it. See a sample report

Sign-up works locally, then real users click the confirmation email and land on localhost. The link is built from your project settings, not from the page the user signed up on.

Where it breaks

Site URLhttp://localhost:3000Redirect URLsyour domain missingEmail linkredirect_to=localhostUser lands onlocalhost: dead pagefallbacknotallowedclickSite URLhttp://localhost:3000Redirect URLsyour domain missingEmail linkredirect_to=localhostUser lands onlocalhost: dead pagefallbacknot allowedclick
The email link uses Site URL unless your redirect is in the Redirect URLs allow list. A missing domain falls back to localhost.

Where to change it in Supabase

Dark Supabase dashboard section titled Redirect URLs, with a green Add domain button and one entry, supachat://**, framed in orange with the number 1.
  1. Redirect URLs (frame 1): add your production domain with a wildcard, for example https://yourapp.com/**, next to your preview domains.
  2. Site URL, on the same URL Configuration page: replace http://localhost:3000 with https://yourapp.com, then save.
Real Supabase dashboard, older layout of Authentication > URL Configuration. Screenshot from a Supabase tutorial (Apache-2.0); the orange frame and number are ours.

Which case is yours?

  1. Authentication > URL Configuration > Site URL is still http://localhost:3000, so it is used as the default redirect.
  2. Or you pass emailRedirectTo / redirectTo with your real domain but that domain is not in the Redirect URLs allow list, so Supabase silently falls back to the Site URL.

The fix, step by step

  1. Set Site URL to your production domain, for example https://app.example.com.
  2. Add every domain you use to Redirect URLs, including preview deployments with a wildcard: https://app.example.com/**, https://*-yourteam.vercel.app/**, http://localhost:3000/**.
  3. Pass the redirect explicitly from the page, built from the current origin.
    await supabase.auth.signUp({
      email, password,
      options: { emailRedirectTo: `${window.location.origin}/auth/callback` },
    });
  4. On the callback route, exchange the code for a session (PKCE flow) before redirecting the user to the app.
    const { error } = await supabase.auth.exchangeCodeForSession(code);

How to check it is fixed

Sign up with a new address from the production site: the email link opens your domain and the user is signed in.

Delivery example for this error

auth/signup.ts · on a branch of your repository- await supabase.auth.signUp({ email, password })+ options: { emailRedirectTo:+ `${origin}/auth/callback` }
Verification checklist in the note
  • Root cause: Site URL in Supabase is still localhost, or your real domain is missing from the Redirect URLs allow list.
  • Change made: Set Site URL to the production domain, add every domain to Redirect URLs, and pass the redirect built from the current origin.
  • Sign up with a new address from the production site: the email link opens your domain and the user is signed in.

Illustrative: the real diff is written against your repository. Full sample report

Still stuck on your own code?

Send the repository and the exact error. Fix: 290 EUR all taxes included, delivered within 72 hours, refunded if not resolved.

Private repository: paste its link anyway, we reply by email within one business day with the GitHub account to invite with read access. A zip link (Google Drive, Dropbox) works too. Never send passwords or secret keys in this form.

Fix: One blocking auth, Supabase RLS or deployment problem fixed in your repository.290 EUR all taxes included · 72 hours

Secure payment by Stripe. Not resolved within 72 hours: refunded in full.

Not sure it is this error? Ask for a free written diagnosis, no card needed.