Why isn't my login working?
Last checked 31 Aug 2026
Short answer
Check the browser console for the actual error first — common causes are unconfirmed email, a redirect URL mismatch, RLS blocking the post-login profile read, or a provider (like Google) misconfigured for the current domain.
Diagnose before you guess
"Login isn't working" covers several different failures. Open the browser console and network tab and note the exact error before asking Lovable to fix anything.
Common causes
- Email not confirmed. If your setup requires email verification, an unconfirmed account will fail to log in even with the correct password.
- Wrong redirect URL. For Google/OAuth providers, the redirect URI configured for the provider must exactly match the domain you're testing on — this differs between your Preview URL and a published custom domain.
- RLS blocking a post-login read. Login can succeed but the app then fails to load the user's profile because of a missing SELECT policy, making it look like "login doesn't work" when auth actually succeeded.
- Testing on the wrong environment. A test/preview environment's auth users are separate from live/published ones — an account created on one won't exist on the other.
- Session not persisting. If a user is logged in but gets bounced straight back to the login page, this is often a routing/protected-route bug rather than an auth problem.
Step-by-step
- Open dev tools, try logging in, and read the exact error from the console/network tab.
- Match the error to the categories above.
- Ask Lovable with the specific error, not just "login is broken":
Login fails with a 403 right after auth succeeds, when the app tries to fetch the user's profile. Check the RLS policy on
profilesfor SELECT.
- Test with a fresh account and an existing one, and on both preview and published URLs if relevant.
What usually goes wrong
- Fixing the login form when the real issue is a database policy running afterwards.
- Not re-testing OAuth providers after adding a custom domain.
- Assuming a bug is universal when it only affects one environment (test vs live) or one provider (email works, Google doesn't).
If login issues persist after checking all of the above, a fresh pair of eyes from PromptSites.com can be faster than continued trial and error.
Related: /questions/how-do-i-add-login-to-lovable, /questions/how-do-i-add-google-login, /questions/why-is-supabase-returning-a-403-error.
Sources
Was this answer helpful?
Related questions
- AnswerHow do I add password reset?Ask Lovable to add a "forgot password" flow — it uses Lovable Cloud's authentication to email a reset link and lets the user set a new password.
- AnswerHow do I add login to Lovable?Ask Lovable to add authentication — it enables Lovable Cloud (if not already on), then generates sign-up/login pages and wires them to email, Google, or other providers.
- AnswerHow do I create admin users?Add a `user_roles` table with an `admin` role, assign it to the specific user's ID, and check that role server-side (in RLS policies and any admin-only functions) rather than trusting a front-end flag.
- AnswerWhy does my app keep redirecting to login?This is almost always a session or route-guard bug: either the auth session isn't persisting, or a protected route checks auth state before it's loaded, so it bounces back to login even when signed in.
You might also need
- GuideHow to Create Protected PagesRestrict routes to signed-in users properly — including the server-side check most AI-generated guards miss.
- GuideHow to Add User Login to a Lovable ProjectSign-up, sign-in, sign-out and sessions — plus the settings people forget that break login on the live site.
- GuideHow to Add User Roles and PermissionsAdmin, editor and member roles done safely — stored separately from user profiles so they cannot be escalated.