A user types their email and password into your login form and gets:
AuthApiError: Invalid login credentials- or, in the network tab, HTTP 400 with
"code": "invalid_credentials"
Sometimes it is just a wrong password. But when the person swears the password is right, or when it happens to you on your own account, something else is going on. This is one of the most common login problems on sites built with Lovable, Bolt, v0, Replit and Cursor that use Supabase for sign-in, and it usually turns up right after launch, when real people start logging in.
The message is vague on purpose. Supabase gives the same reply for several different situations so that a login form can't be used to find out who has an account. That's good for security, but it means you have to work out the cause yourself, from your side.
Step 1: make sure it really is this error
Read error.code in your code (not just the message text). Supabase's docs recommend matching on error.code, because several login failures look similar on screen.
error.code | What it means | Where to look |
|---|---|---|
invalid_credentials | Email and password not accepted (this page) | Steps 2–5 below |
email_not_confirmed | The email and password were right, but the address isn't confirmed yet | Step 6 |
email_provider_disabled | Email + password sign-in is turned off for the project | Authentication settings, Email provider |
over_request_rate_limit (HTTP 429) | Too many attempts from this IP or user | Wait, then add a friendly "try again in a minute" message |
Invalid API key (no auth code) | The site is using a key from a different project | Step 3 |
If your login form shows the same "Invalid email or password" text for every error, log error.code and error.status to the console while you test. Many builder-generated forms swallow the real code.
Step 2: the three causes behind invalid_credentials
In the Supabase Auth server, a password sign-in returns the same Invalid login credentials reply from three different places:
- No user with that email exists in this project. A typo at signup, a second address (work vs personal), or a user who signed up somewhere else.
- The user exists but has no password. They signed up with Google, GitHub or another sign-in button, or with a magic link. There is nothing to compare the typed password to.
- The password doesn't match. A changed password, a password manager filling an old one, or a stray space.
An unconfirmed email is not one of these three. That has its own code (email_not_confirmed), and it only appears after the password has already been accepted. So if you see invalid_credentials, turning off "Confirm email" won't fix it.
To find out which one you have, look up the user from your side.
In the dashboard: Authentication → Users, search for the email. No row means cause 1. A row whose provider is only google (or another OAuth provider) means cause 2. A row with the email provider means a password exists, so it's cause 3.
In the SQL editor (runs as an admin, never from your site):
select u.id,
u.email,
u.email_confirmed_at,
coalesce(u.encrypted_password, '') <> '' as has_password,
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;
- No rows → cause 1, or you're looking at the wrong project (Step 3).
has_passwordfalse, providers likegoogle→ cause 2 (Step 4).has_passwordtrue → cause 3 (Step 5).
Never add a public endpoint that tells the browser which of the three happened. That undoes the protection the vague message gives you.
Step 3: check the site talks to the right project
This one catches site owners more than users. The account exists, just not in the project your live site is calling.
Common ways it happens:
- You signed up while testing against one Supabase project (a local one, a branch or an old test project), and the live site points at another.
- Preview and live use different environment variables, so the preview login works and the published one doesn't (or the other way round).
- You copied the site or remixed a template, and it kept the original project's URL and key.
- You moved to a new Supabase project but only migrated the tables, not the users in
auth.users.
How to check: open your live site, open the browser's developer tools, go to the Network tab, try to log in, and look at the request to /auth/v1/token?grant_type=password. The host (https://<project-ref>.supabase.co) is the project your site really uses. Compare that project ref with the one you open in the dashboard. If your build tool keeps separate settings for preview and published versions, check both.
If they don't match, fix the environment variables (the Supabase URL and the publishable or anon key) and publish again. A key from a different project usually fails earlier with Invalid API key, but a URL and key pair from the wrong project will happily return invalid_credentials for every real user.
Step 4: users who signed up with Google or a magic link
If your site offers "Continue with Google" and an email + password form side by side, some people will sign up with Google and later try to log in with a password. Supabase never stored a password for them, so every attempt fails.
The same goes for magic-link signups: the account is created without a password the user ever chose.
Fixes, from least to most work:
- Tell people on the form. Under the error, add: "If you signed up with Google, use the Google button." This alone clears most support emails.
- Let them set a password. The normal password reset flow (
resetPasswordForEmail, thenupdateUser({ password })on your reset page) adds a password to an existing account. After that, both sign-in methods work. - Check your provider settings. If you meant to offer only one way to sign in, hide the other one on the live site.
Don't create or patch rows in auth.users with SQL to "give" someone a password. That leaves required auth columns empty and breaks sign-in later. Use the dashboard, the reset flow or the Admin API on your server.
Step 5: the password really doesn't match
If the user exists and has a password, the typed password is wrong, or it's being changed on the way:
- Spaces and case in the email. Trim the email and lower-case it the same way at signup and login:
email.trim().toLowerCase(). Supabase compares emails case-insensitively, but a trailing space from a pasted address can still cause trouble in your own code and lookups. - Don't trim the password. Passwords can legitimately contain spaces. But check your form isn't trimming at signup and not at login (or the other way round).
- Password managers often fill an old password after a reset. Ask the user to type it by hand once.
- A password reset that never finished. If your reset page doesn't call
updateUsersuccessfully, the old password stays in place while the user thinks it changed. Test the whole reset journey on the live site, including the page the email link opens. Redirect problems there are covered in Supabase Auth Broke After Deploy? The Usual Suspects, in Order and Login emails pointing to localhost? Fix your auth redirect URLs. - Imported users. If you moved users from another system, their old password hashes only work if Supabase can read that hash format. If imported users can't log in but new users can, the import is the cause; send those users a reset link.
- Form bugs. The builder may have wired the login button to the signup function, or sent the wrong field as the password. Log what your code passes to
signInWithPassword(never log the password itself, just its length) while you test.
If nothing fits, send the user a password reset link. It's the quickest way to get them in while you keep looking.
Step 6: "Email not confirmed" is a different problem
If the code is email_not_confirmed, the email and password were right, but the project requires a confirmed address and this one isn't confirmed yet. Usual reasons:
- The confirmation email never arrived (default email limits, spam folders, no custom email sender). See Sign-up emails not arriving? Fix auth mail.
- The confirmation link opened a broken page or the wrong address, so the confirmation didn't complete (check Site URL and redirect URLs).
- The user signed up, closed the tab and is now trying to log in.
Fix it by making the confirmation email reliable, offering a "resend confirmation" button (supabase.auth.resend({ type: 'signup', email })), and showing a clear message such as "Check your inbox to confirm your email" instead of a generic error. Turning off "Confirm email" is a product decision, not a bug fix, and it doesn't help invalid_credentials at all.
Step 7: when nobody can log in at all
If every user, including you, suddenly gets an error, it's rarely a password problem:
- Paused project. Free Supabase projects pause after a period of inactivity, and requests fail until you restore them. See Data gone? Your free backend may be paused.
- Changed keys or URL. A new deploy, a remix or a keys change pointed the site at another project (Step 3).
- Email sign-in turned off. The code will be
email_provider_disabled. - Rate limits. Lots of failed attempts from one office or network can trigger 429 responses for everyone behind that IP.
Make the login form honest (without leaking accounts)
A good login form keeps Supabase's protection but still helps people:
- Show one general message for
invalid_credentials: "That email and password don't match. If you signed up with Google, use the Google button. Forgot your password?" - Show a specific message for
email_not_confirmed, with a resend button. - Show a "try again in a minute" message for 429s.
- Log the code (not the password) so you can see patterns in your error tracking.
Quick checklist
- Read
error.code: is it reallyinvalid_credentials? - Look the user up in Authentication → Users or with the SQL above.
- Compare the project your live site calls (Network tab) with the project you're looking at.
- OAuth or magic-link users: point them to the right button, or let them set a password through reset.
- Trim and lower-case the email the same way at signup and login; don't trim passwords.
- Test the full password reset journey on the live site.
- Handle
email_not_confirmedand 429 with their own messages. - Log in with a fresh test account in a private window on the published site, not just the preview.
Login problems hide behind a form, so they're easy to miss until a customer emails you. The free 30-second health check shows which pages on your live site fail to load, which links are broken and what errors appear in the console. For ongoing coverage, FlowCanary offers Daily monitoring of your signup, login and checkout (in development; founding spots $19/month, price locked for life, full refund on request any time before it launches).
