Fix guides · Lovable, Bolt, v0, Cursor, Claude Code ·

Fix Supabase "Invalid login credentials" and "Email not confirmed"

AuthApiError: Invalid login credentials

"Invalid login credentials" (code invalid_credentials) means Supabase found no user with that email and password in this project. Common reasons are a wrong password, a user who signed up with Google or a magic link and has no password, or an app that talks to a different Supabase project than the one the user signed up in. If the email isn't confirmed yet, Supabase answers with "Email not confirmed" (email_not_confirmed) instead.

Free · 3 a day · no signup

Common causes – and how to tell which one you have

1. The app is connected to a different Supabase project

How to tell: The user exists in the Supabase Dashboard (Authentication → Users) of one project, but the app's SUPABASE_URL / anon key (or VITE_ / NEXT_PUBLIC_ variables) point to another project, for example a preview or old project.

Fix: Compare the project URL in your environment variables with the dashboard you're looking at. Set the correct values on your host for every environment and redeploy.

2. The user has no password (signed up with Google, GitHub or a magic link)

How to tell: In Authentication → Users the user's provider is google, github or the account was created via magic link or invite, and they now try to log in with email and password.

Fix: Let them log in with the original method, or send a password reset (resetPasswordForEmail) so they can set a password.

3. Wrong password, extra spaces or wrong email casing in the form

How to tell: It fails for one user but works for a test user. The form passes the value with a trailing space or from the wrong input field.

Fix: Trim the email, send the exact password the user typed, and check that the form reads the right fields. Offer 'Forgot password?' with resetPasswordForEmail.

4. Email not confirmed

How to tell: The error says "Email not confirmed" (email_not_confirmed), and in Authentication → Users the user has no confirmed date. Often the confirmation email never arrived because the built-in email service has strict rate limits.

Fix: Resend the confirmation email (supabase.auth.resend({ type: 'signup', email })), set up your own SMTP provider for production, and make sure the Site URL and redirect URLs point to your live domain so the link in the email works.

5. The sign-up never created the user

How to tell: The user isn't in Authentication → Users at all. The sign-up call returned an error that the app didn't show, or a database trigger on new users (like handle_new_user) failed.

Fix: Show the error returned by signUp in the UI, check the Auth logs in the Dashboard, and fix any failing trigger on auth.users before testing again.

How to fix it

  1. Open the Supabase Dashboard of the project your app actually uses (check the project URL in your environment variables) and go to Authentication → Users.
  2. Search for the email. If it's missing, the sign-up failed or went to another project.
  3. If the user exists, check the provider column and whether the email is confirmed.
  4. Unconfirmed: resend the confirmation email and check that Site URL and redirect URLs in Authentication → URL Configuration match your live domain.
  5. No password (Google or magic link): log in with that method or send a password reset.
  6. Try the login again and log the full error object (error.code) in the browser console to confirm which case it was.

Using Lovable, Bolt or v0?

In Lovable or Bolt, check first which Supabase project is connected (Lovable: the Supabase integration; Bolt: the .env values) and look the user up in that project's Authentication → Users. Then tell the AI: "Login fails with Invalid login credentials. Show the real Supabase error code in the UI, add a password reset and a resend-confirmation button, and make the email links use my published domain."

Using Cursor, Claude Code or Windsurf?

Ask Cursor or Claude Code to find every place the Supabase client is created and print which environment variables it reads, then compare them with your hosting settings. Have it log error.code from signInWithPassword and signUp, and add resetPasswordForEmail and auth.resend flows. Verify with a fresh test account in the same project.

The “fix” to avoid

A common 'fix' is turning off email confirmation in Supabase so new users can log in immediately. That lets anyone sign up with someone else's email address. Another is creating users with the service role key from the browser — never ship that key to the client.

Copy-paste fix prompt for your AI coding tool

Paste this into Cursor, Claude Code, Lovable or Bolt:

My app's Supabase login fails with "Invalid login credentials" (or "Email not confirmed"). Check: 1) which Supabase project URL and anon key the app uses in each environment, and tell me where they're set; 2) that signInWithPassword receives the trimmed email and the exact password from the right form fields; 3) that signUp errors are shown to the user, not swallowed; 4) that the confirmation and reset links use my live domain (emailRedirectTo / redirectTo). Add a 'Forgot password?' flow with resetPasswordForEmail and a 'Resend confirmation' button using supabase.auth.resend. Show a clear message for error.code invalid_credentials and email_not_confirmed. Do not disable email confirmation.
Your error looks a bit different? Paste your exact error and get a diagnosis tailored to your code — free.

Questions people ask

What's the difference between Invalid login credentials and Email not confirmed?

Invalid login credentials means the email and password don't match a user with a password in this project. Email not confirmed means the user exists and the password is right, but they haven't clicked the confirmation link yet.

Why don't my confirmation emails arrive?

Supabase's built-in email service is meant for testing and has a low hourly limit. For a real app, add your own SMTP provider in the Auth settings and check the spam folder.

The user signed up with Google. Why can't they log in with a password?

Accounts created through Google, GitHub or a magic link don't have a password. They need to use the same method again or set a password through a reset email.

Official documentation

Related errors

Get fixes like this every week