MELLEPRISE MELLEPRISE AI MP Blog
← All articles

Lovable authentication errors: decode the code before changing settings

Pastel comic of a browser window with a padlock and several warning tickets being sorted into labeled trays

The user types the right password, Google opens and closes, or the confirmation mail never arrives β€” and the app only says that sign-in failed. Lovable authentication errors feel random because generated apps often hide the one detail that matters: the real error code.

Lovable authentication errors: start with the backend, not the button

Before changing a setting, answer one question: who signs your users in?

  • Lovable Cloud, the built-in backend. Authentication settings live in More β†’ Users β†’ Settings. Google, Apple, Microsoft and Lovable sign-in require this backend.
  • Your own Supabase project. Lovable may have connected it, but Supabase owns the auth settings. Open Supabase β†’ Authentication for URL configuration, providers, rate limits and logs.
  • A different auth provider. If the generated code contains Firebase or another provider configuration, the Lovable and Supabase settings below will not fix it.

This split explains the most confusing cases: the same email can exist in one backend and not in the other; Google can work in preview because Lovable manages it there, while your own credentials fail on a custom domain; and a redirect rule edited in Lovable does nothing for a project that actually uses external Supabase.

Get the real error before touching production

Do not keep clicking the button. Reproduce the failure once in a private window and collect the message in this order:

  1. Browser console. Open developer tools, choose Console and sign in again. Generated code often logs the full auth error even when the interface only shows a generic toast.
  2. Network tab. Filter for auth/v1. Password sign-in usually calls token; sign-up calls signup. Open the failing response and read error_code and msg.
  3. Auth logs. In an external Supabase project, open Logs β†’ Auth. This is the only place that reliably shows server-side sign-up failures and database-trigger details.

When the generated form swallows the failure, ask Lovable for a narrow change: display the authentication error message in development and branch on error.code, not on the text. Supabase documents the code as the stable field; message text can change.

const { error } = await supabase.auth.signInWithPassword({
  email,
  password
});

if (error) {
  console.error(error.code, error.status, error.message);
}

The error-code map that actually helps

Match the code first. Do not treat every login problem as a redirect problem.

  • invalid_credentials β€” Invalid login credentials. The email and password do not match in this backend. The user may have signed up with Google, may never have finished sign-up, or may exist in the other Supabase project. Supabase intentionally does not tell you which part failed.
  • email_not_confirmed β€” Email not confirmed. The password was accepted, but the address is still unconfirmed. Signing in again does not resend the confirmation email. On Lovable Cloud, the user signs up again with the same address, or you create them through Add user β†’ Create new user, which confirms the account automatically.
  • email_address_not_authorized. On external Supabase, the built-in email service is for testing only. It sends to team-member addresses, not arbitrary users. Production email needs custom SMTP or a Send Email hook.
  • user_already_exists. The email already has an account. A silent sign-up is often correct anti-enumeration behavior; move the user to sign-in or password reset instead of creating duplicate accounts.
  • over_email_send_rate_limit. Too many authentication emails were sent. On Lovable Cloud, check More β†’ Users β†’ Settings β†’ Email β†’ Advanced. New projects start at 1,000 authentication emails per hour when project email sending is active; custom email sending and workspace limits still apply. On external Supabase, the built-in provider is far more restrictive and custom SMTP is the production answer.
  • over_request_rate_limit. Too many sign-in or sign-up attempts came from one IP address or user flow. This is a throttle, not broken credentials. Stop retry loops before changing secrets.
  • otp_expired, flow_state_expired. The email link, one-time code or PKCE flow state expired. Start the flow again from the app; do not reuse an old inbox link.
  • refresh_token_not_found, session_not_found, Auth session missing. The stored session is gone or the app checked for a user before the client finished restoring it. Sign in again and inspect the generated session-loading logic before adding redirects.
  • signup_disabled or provider disabled. Sign-up or that provider is switched off. In Lovable, also check whether a Business or Enterprise workspace policy blocks the method; a locked method shows a workspace-policy badge.

Fix redirect errors without breaking working sign-in

Redirect problems are common, but they are only one branch of lovable authentication errors. Use this click path when sign-in works in preview and fails on the published app or custom domain:

  1. Open the right settings. On Lovable Cloud: More β†’ Users β†’ Settings β†’ Advanced. On external Supabase: Authentication β†’ URL Configuration.
  2. Check Site URL. This is the default address users return to after authentication when no redirect URL is specified. It should be the public address people actually use.
  3. Check Redirect URLs. Lovable allows up to 50 URLs. A published address or custom domain must be listed before auth can return there. End a web address in /**, for example https://app.example.com/**, when every path should match.
  4. Do not use localhost for local testing. Lovable rejects localhost addresses. Open the local app as http://127.0.0.1:5173 and add http://127.0.0.1:5173/** instead.
  5. Retest in a private window. Old cookies and half-expired auth flows can reproduce a failure that is already fixed.

On the built-in backend, Lovable keeps much of this current for you: publishing sets the Site URL unless it is already on your domain, and connecting a custom domain adds it to redirect URLs. External Supabase is different. Lovable adds addresses it serves, but the Site URL and outside addresses are your job in that Supabase project.

Google errors: managed by Lovable or your own credentials

Google sign-in has two separate ownership models. Managed by Lovable needs no Google Cloud setup. Your own credentials gives you control of the consent screen and security settings, but also makes you responsible for Google Cloud.

If Google shows Error 400: redirect_uri_mismatch, the URI sent to Google is not authorized exactly on the OAuth client. Copy every redirect URI listed in Lovable into Authorized redirect URIs in Google Cloud. Then return to Lovable, select only the URIs you actually added and save. Exact means exact: scheme, domain, path and trailing slash.

If Google shows Access blocked or says the app has not completed verification, check the OAuth consent screen. While the Google Cloud app is still in testing, only listed test users can sign in. If Google rejects the client type, recreate it as a Web application; mobile and desktop OAuth clients do not fit Lovable’s redirect flow.

A custom domain adds one more trap: Lovable may add the domain’s redirect URI to the list, but it is not selected automatically for your own credentials. Add it in Google Cloud first, then select it in Lovable. Selecting it too early creates the exact mismatch you were trying to remove.

When users say the mail never arrives, separate deliverability from link configuration:

  • No mail at all: spam folder first, then the project or provider sending limit, then custom email setup.
  • Mail arrives but opens the wrong host: the Site URL or redirect list still points at a preview or development address. Send a fresh email after fixing it; old links keep the old destination.
  • User stuck unconfirmed: sign up again with the same email to trigger a new confirmation on Lovable Cloud, or create the user in the Users view. Do not disable confirmation permanently just to make the problem disappear.
  • Magic-link or reset flow loops: check the final landing URL, then the generated route that consumes the token. A correct email can still land on a page that does not complete the flow.

If the missing message is specifically a Lovable confirmation or verification mail, the focused guide on lovable email not sending goes deeper into deliverability. If the address itself is wrong after publish, compare the broader lovable login redirect checklist.

External Supabase: the extra production checks

When your project uses your own Supabase backend, Lovable cannot repair the auth settings for you. Work through this sequence:

  1. Confirm the project ref. The browser network calls should hit the same Supabase project you are editing. A preview connected to one project and production connected to another creates impossible-looking credential errors.
  2. Set Site URL and Redirect URLs. Include the published Lovable address, custom domain and controlled local test origin. Do not paste secrets into the frontend.
  3. Check providers. Email, Google and any other provider must be enabled in the same project that receives the request.
  4. Check rate limits. Supabase uses token-bucket limits on auth endpoints. Sign-up/sign-in limits are commonly per IP; email sending has separate limits. A 429 is a throttle response, not proof that the account is broken.
  5. Use production email. The built-in mail service is for trying Auth. For real users, configure custom SMTP or a Send Email hook before launch.

For callback-specific failures, use the narrower supabase oauth and supabase auth guides after you have confirmed the project really is external Supabase.

Production checklist before you call it fixed

  • The real error code was captured from console, network or auth logs.
  • The backend is known: Lovable Cloud, external Supabase, or another provider.
  • Published URL and custom domain are in Redirect URLs; local testing uses 127.0.0.1, not localhost.
  • Google OAuth uses a Web application client, exact authorized redirect URIs, and a consent-screen state that allows the test user.
  • Confirmation email is enabled for production, and sending does not depend on the test-only built-in Supabase mailer.
  • Sign-in was retested in a private window on the published app and on the custom domain.
  • The launch-wide settings are cross-checked with the lovable deploy checklist.

Most lovable authentication errors are not mystery bugs. They are a small number of ownership mistakes: wrong backend, wrong redirect URI, wrong OAuth client, wrong email sender, or an error code nobody read.

FAQ

Why does Lovable say Invalid login credentials when the password is right?

The account may not exist in that backend, may have been created with Google instead of a password, or may belong to the other Supabase project. Confirm which backend the app uses, then check the auth log before resetting anything.

Why do confirmation emails from my Lovable app stop arriving?

Check spam first. On Lovable Cloud, review More β†’ Users β†’ Settings β†’ Email β†’ Advanced and the hourly sending limit. On your own Supabase project, the built-in mailer is only for testing and is severely limited; use custom SMTP or a Send Email hook for production.

What is the first thing to check when Google sign-in fails with redirect_uri_mismatch?

The redirect URI sent to Google is not authorized exactly on your OAuth client. Copy every redirect URI shown in Lovable into Authorized redirect URIs in Google Cloud, then select only those added URIs in Lovable and save. Scheme, domain, path and trailing slash must match exactly.