Supabase error invalid_credentials (invalid_credentials) explained: what it means, why it happens, and how to fix it — with copy-paste code examples.
Double-check the email and password for typos, case, and trailing spaces. If that does not apply, ensure the user signed up with email/password and not an OAuth provider — the full checklist is below.
Error code: invalid_credentials
Official name: invalid_credentials
Service: Supabase
Login credentials or grant type not recognized.
const { data, error } = await supabase.auth.signInWithPassword({
email: email.trim().toLowerCase(),
password,
})
if (error?.code === 'invalid_credentials') {
// generic message: do not leak whether the email exists
alert('Invalid email or password')
}
Normalize the email before sending and branch on error.code so users see one consistent message.
signInWithPassword returns an AuthApiError with code invalid_credentials. Inspect error.code and show a generic message.
const { error } = await supabase.auth.signInWithPassword({ email, password })
if (error?.code === 'invalid_credentials') {
showError('Invalid email or password')
}
AuthApiException exposes the error code via exception.code; map it to a user-facing message.
try {
await supabase.auth.signInWithPassword(email: email, password: password)
} on AuthApiException catch (e) {
if (e.code == 'invalid_credentials') {
showSnackBar('Invalid email or password')
}
}
Most often this happens when wrong email or password passed to signInWithPassword(), or when user signed up with an OAuth provider (e.g. Google) but tries to sign in with email/password.
Double-check the email and password for typos, case, and trailing spaces.
This page documents fixes for: supabase-js, supabase-flutter.
Recommendations are editorial — DB Error Reference takes no payment or affiliate fees for tool listings.
This page is based on the official Supabase documentation linked below and adds practical troubleshooting guidance on top.