Guide
"Invalid login credentials" in Supabase: why sign-in fails and how to fix it
How this guide was made: Written with AI assistance and checked against the sources linked on this page.
Updated
Short answer
Supabase returns "Invalid login credentials" (code invalid_credentials) when signInWithPassword can't match the email and password. The usual reasons: the password is wrong, no user with that email exists in this project, the user signed up with Google or a magic link and never set a password, or your app is connected to a different Supabase project.
What it means
Supabase's error list describes invalid_credentials as "Login credentials or grant type not recognized." It doesn't say which part failed. It gives the same answer for a wrong password and for an email that isn't registered, so the message alone can't tell you which one you have. You find out by looking at the user record.
An unconfirmed email is a different error. Supabase has a separate code, email_not_confirmed, for that case. If you see "Invalid login credentials", look at the four causes below first.
Causes
| Cause | How to tell | Fix |
|---|---|---|
| Wrong password, or a typo in the email | The user exists in Authentication > Users and has the email provider. Other users can sign in. | Let the user reset the password (step 4). Trim spaces from the email field (step 5). |
| No user with that email in this project | The SQL in step 2 returns no rows. | The user needs to sign up first. Check that your sign-up code doesn't swallow errors (step 6). |
| The user signed up with Google, GitHub or a magic link and has no password | The SQL in step 2 shows only google, github or similar under providers, or the user only ever used a magic link. | Send them through password reset, or let them sign in the way they signed up (step 4). |
| The app talks to a different Supabase project (for example staging instead of production) | The project URL in your app's environment variables doesn't match the project where the user appears. | Point the live app at the right project and redeploy (step 3). |
How to fix it
1. Log the full error in your sign-in code
Show the code as well as the message, so you know whether it's invalid_credentials or email_not_confirmed:
const { data, error } = await supabase.auth.signInWithPassword({
email: email.trim(),
password,
})
if (error) {
console.error('Sign-in failed:', error.code, error.status, error.message)
// Show the user a plain message, not the raw error
setMessage(
error.code === 'email_not_confirmed'
? 'Please confirm your email first. Check your inbox.'
: 'Email or password is incorrect.'
)
return
}
2. Check the user in your project
Open the Supabase Dashboard for the project your live app uses, go to SQL Editor and run this. Replace the email with the one that fails:
select
u.id,
u.email,
u.email_confirmed_at,
u.created_at,
array_agg(i.provider) as providers
from auth.users u
left join auth.identities i on i.user_id = u.id
where lower(u.email) = lower('person@example.com')
group by u.id;
How to read the result:
- No rows. This project has no user with that email. Go to step 3, then step 6.
providershas onlygoogle,githubor another OAuth provider. The user never set a password. Go to step 4.providersincludesemailandemail_confirmed_athas a date. The account exists and is confirmed. Either the password is wrong, or the user only ever signed in with a magic link and never set a password. Step 4 fixes both.email_confirmed_atis empty. The email isn't confirmed. Supabase reports this asemail_not_confirmed, so check what step 1 logs.
3. Make sure the app uses the right project
Find the Supabase URL your live app actually uses. In a Vite app the variable is named VITE_SUPABASE_URL. In Next.js it's NEXT_PUBLIC_SUPABASE_URL. Check the value in your hosting provider's environment settings, not only in your local .env file.
Add this line temporarily and open the live site:
console.log('Supabase project:', import.meta.env.VITE_SUPABASE_URL)
// Next.js: console.log('Supabase project:', process.env.NEXT_PUBLIC_SUPABASE_URL)
The ID in that URL (https://<project-id>.supabase.co) must match the project where you ran step 2. If it doesn't, update the URL and the anon key in your hosting environment, redeploy, and remove the log line.
4. Let the user set a password
This fixes a forgotten password and also an account that never had one. Add a "Forgot password" link that calls:
const { error } = await supabase.auth.resetPasswordForEmail(email.trim(), {
redirectTo: 'https://your-live-domain.com/update-password',
})
Add that redirectTo address to the Redirect URLs list on your Supabase project's URL Configuration page, or the link won't take the user there.
On /update-password, once the user arrives from the email link, save the new password:
const { error } = await supabase.auth.updateUser({ password: newPassword })
Two things to know:
- If no user has that email, Supabase sends no email and still returns no error. Don't tell users "email sent" as proof that the account exists.
- A user who is already signed in with Google can add a password with the same
updateUser({ password })call. After that, email and password sign-in works for them too.
If the reset email never arrives or the link opens the wrong site, that's a separate problem. See reset email not sending and reset link opens the wrong site.
5. Trim the email before you send it
Autofill or a mobile keyboard can add a space at the end of the email. Trimming it is safe. Leave the password exactly as typed:
const cleanEmail = email.trim()
await supabase.auth.signInWithPassword({ email: cleanEmail, password })
Do the same in your sign-up and reset code so all three use the same value.
6. Make sure sign-up really creates the user
If step 2 found no user even though the person "signed up", your sign-up code may be ignoring an error. Check it:
const { data, error } = await supabase.auth.signUp({
email: email.trim(),
password,
})
if (error) {
console.error('Sign-up failed:', error.code, error.message)
setMessage(error.message)
return
}
Then sign up with a fresh test email and confirm the user shows up in Authentication > Users.
One case where no error appears: if the email already belongs to a user who signed up with Google or another provider, Supabase returns a normal-looking response, sends no confirmation email and sets no password. That user still gets "Invalid login credentials" with a password. Send them through step 4.
How to check it's fixed
- Open the live site in a private window, not the preview.
- Sign in with an email and password that you just confirmed in step 2 (
emailprovider, confirmed date set). You should land signed in, with no error in the console. - Run the password reset for an account that had no password, set a new one, and sign in with it.
- Type a wrong password on purpose. You should see your own "Email or password is incorrect" message, not a blank screen or the raw error.
FAQ
Why does Supabase show the same error for a wrong password and an unknown email?
invalid_credentials covers both cases. To find out which one you have, run the query in step 2 against the project your live app uses.
The user signed up with Google. Why can't they sign in with email and password?
A Google sign-up doesn't create a password. The user can keep using Google, or set a password through the reset flow, or with updateUser({ password }) while signed in.
Sign-in works in my preview but not on the live site. Why?
The live site can be connected to a different Supabase project, or its environment variables were never set. The user exists in one project and not the other. Step 3 shows which project the live app uses.
---
Still failing? Run a free check on your live app at vibe-fixer.com. Our AI agent finds the cause, and for $79 it fixes the code and re-checks your live app.
Can VibeFix fix it for me?
Yes, for apps built in Lovable or any app whose code is on GitHub. The free check confirms the problem on your live app first. If you want it fixed, our AI agent finds the cause, fixes it in your code for $79 and tests your live app again. See pricing.
Sources
- <https://supabase.com/docs/guides/auth/debugging/error-codes>
- <https://supabase.com/docs/reference/javascript/auth-signinwithpassword>
- <https://supabase.com/docs/guides/auth/passwords>
- <https://supabase.com/docs/guides/auth/auth-identity-linking>
- <https://supabase.com/docs/guides/auth/identities>
- <https://supabase.com/docs/guides/auth/users>
- <https://supabase.com/docs/guides/auth/redirect-urls>
Last checked: 16 November 2026.
VibeFix is independent. Supabase and Stripe are trademarks of their owners.
Want it fixed?
Our AI agent fixes it in your code for $79 and tests your live app again. If we can't complete your re-check, you get your money back.
It starts with a free check that confirms the problem on your live app, no account needed.
More guides · Shopify store accessibility · About · Your privacy choices