Paul Milliken

Error guide

Sign-in loops, or lands on the wrong page

What it means

After someone signs in or clicks the email link, the auth service sends them to an address. If that address isn't on its allowed list, it sends them to the default (the Site URL) instead, which may be the login page, a preview address or localhost.

Check these, in order

  1. The Site URL and Redirect URLs. On Lovable Cloud: More → Users → Settings → Advanced. On your own Supabase project: Authentication → URL Configuration. The Site URL should be your live address. Every address users sign in on (the live domain, a custom domain) should be in Redirect URLs.
  2. The address your code asks for. Search your code for emailRedirectTo or redirectTo. A fixed address there, such as http://localhost:3000, sends every user to that address. Using the address the app is running on (window.location.origin) avoids that, as long as that address is also on the allowed list.
  3. A custom domain. If you moved to your own domain, check it is in Redirect URLs exactly, including https:// and any www.

Practice app: in one of my practice apps, where I planted this fault to test my checks, the sign-in link pointed at a local test address (localhost), so the email link would have sent real users to an address that only works on the developer's computer. The fix was to build the link from the address the app is running on.

Still stuck? Send me the app

I'll show you what's wrong, on video, within 24 hours. Free.

Free. No call. If I can't find the cause, I'll tell you so.

Please don't put passwords or keys in the form.