App Finishers

Fix guide · updated 2026-11-15

Supabase "Invalid login credentials" error

AuthApiError: Invalid login credentials · invalid_credentials · 400

The user is sure of their email and password, and Supabase still answers "Invalid login credentials". Sometimes it's every user, right after you published. Supabase uses this one message for several different problems, on purpose, so the message alone won't tell you which one you have. Here's the list, and a two-minute check that tells them apart.

What the error means

We read the sign-in code in Supabase Auth (internal/api/token.go). An email and password sign-in answers HTTP 400 with the code invalid_credentials and "Invalid login credentials" when:

The first three are the real causes. Supabase gives them all the same answer so a stranger can't use your login form to test which emails have an account. That's good security, and it's also why you have to look at the account yourself (see "Find your case in two minutes" below). Upper or lower case in the email is never the problem: Supabase compares emails in lower case.

1. The account isn't in the project your app talks to

This is the most common one in apps built with AI tools. You look at the users in one Supabase project, but your app is connected to another: a preview and a live version with different settings, a remix that made a new project, or a .env file from an older setup. For that other project, the account doesn't exist, so the answer is "Invalid login credentials".

Check the address your app uses: it's the URL passed to createClient(), often in VITE_SUPABASE_URL or NEXT_PUBLIC_SUPABASE_URL. It looks like https://abcdefgh.supabase.co. Those 8 letters are the project's reference, and the dashboard shows the same reference in its own address bar. If they differ, you're looking at the wrong project, or your app is.

2. The account has no password

People who signed up with Google or GitHub, with a magic link, with a one-time code, or who were invited and never finished, have no password stored. Supabase checks for one before anything else, and with none it answers "Invalid login credentials", even if they type a password they use elsewhere.

They can sign in the way they signed up. Or they can set a password through your reset flow: send the email, and on your reset page save the new password.

// "Forgot password?" link
await supabase.auth.resetPasswordForEmail(email, { redirectTo: 'https://yourapp.com/reset' });

// On https://yourapp.com/reset, once the link has logged them in
const { error } = await supabase.auth.updateUser({ password: newPassword });

If your app offers Google and email at once, say it on the login form: "Signed up with Google? Use the Google button."

3. The password really is different

Supabase compares exactly what your form sends. A password manager filling an old password, Caps Lock, a form that adds or keeps a space, or a password changed on another device will all fail. Before digging into code, reset the password of one test account and sign in with the new one. If that works, the system is fine and the problem is what was typed.

4. You created the users yourself, with SQL or a seed script

Supabase stores a hash of the password in auth.users.encrypted_password and checks it with bcrypt (argon2 and Firebase scrypt hashes are also accepted, for imports). An AI-written script that inserts users straight into auth.users often puts the password there as plain text, or skips it. Those accounts can never sign in, whatever is typed. A script can also put a random value in instance_id: Auth only looks for users whose instance_id is all zeros, so in our test such an account got Invalid login credentials with the right password (the fix is in our guide to "Database error querying schema").

Create users through Supabase instead, from a server with your service role key (never in browser code):

import { createClient } from '@supabase/supabase-js';

const admin = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_SERVICE_ROLE_KEY);
const { error } = await admin.auth.admin.createUser({
  email: 'person@example.com',
  password: 'a-long-password',
  email_confirm: true,   // skip the confirmation email for accounts you create yourself
});

For accounts that already exist with a broken password, send them a reset (case 2), or set a new one from the server with admin.auth.admin.updateUserById(userId, { password }). If that call fails with Database error loading user, the row has NULL columns: fix them first with our guide to "Database error querying schema".

5. A password hook, or bad timing

If you added a "password verification attempt" hook (Authentication → Hooks), it can reject a sign-in, and Supabase then answers with this code and your hook's message (by default "Further password verification attempts will be rejected."). And if the password is changed at the very moment someone signs in, Supabase refuses that sign-in rather than let the old password through. Both are rare. If you never set up a hook, skip this one.

Find your case in two minutes

In the Supabase dashboard of the project your app really uses (case 1), open the SQL editor and run:

select email,
       email_confirmed_at,
       coalesce(encrypted_password, '') <> '' as has_password,
       raw_app_meta_data->>'provider' as signed_up_with
from auth.users
where lower(email) = lower('person@example.com');

If an AI tool built your app

Give your AI tool this prompt, so your users see a useful message instead of a dead end:

On the login form, when Supabase returns the error code invalid_credentials, show "Wrong email or password" with a "Forgot password?" link that calls supabase.auth.resetPasswordForEmail(email, { redirectTo: window.location.origin + '/reset' }). Add a /reset page that saves the new password with supabase.auth.updateUser({ password }). If the app also has Google sign-in, add the line "Signed up with Google? Use the Google button." Don't change anything else.

Then check case 1 yourself: the Supabase URL in your app's settings must be the project you look at in the dashboard.

Not quite your error?

Still stuck?

Open the Auth logs in your Supabase dashboard at the time of the failed sign-in. You'll see the request with invalid_credentials, but not which case it was: Supabase keeps that private by design. The SQL check above is how you find out. If the row looks right and a fresh password still fails, look at what your form really sends: log the email and the password's length (never the password) just before signInWithPassword.

Other Supabase problems? See Supabase fixes.