Skip to content

signInWithPassword does not return an error code when the login credentials are invalid #1662

Description

@moralestapia

I confirm this is a bug with Supabase, not with my own application.
I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Most (all?) other supabase.auth methods return a code property in the error object, if there's any, as documented here.

supabase.auth.signInWithPassword does not, for some reason, and one has to check if the error message property is equal to "Invalid login credentials".

This breaks consistency across the platform and makes people write code that may not be future-proof. If error.message changes then it's gg, while error.code somehow implies a guarantee of stability across time.

To Reproduce

await supabase.auth.signInWithPassword({ email:[some valid email], password:[some invalid password] });

Expected behavior

An error object with a defined code property.

Screenshots

N/A

System information

@supabase/ssr@0.1.0
@supabase/supabase-js@2.43.5

Node version: 20.15.0

Additional context

I < 3 supabase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    authbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions