Request for Improved Response Status in supabase.auth

It is actually already posted in Sept 26, 2023 on Github but it has no feedback at all
https://github.com/orgs/supabase/discussions/17706

I'd like to open a discussion regarding the current response structure in supabase.auth. Currently, when making requests related to user authentication, we receive JSON responses that look like this:

For invalid credentials:
{"data": {"session": null, "user": null}, "error": [AuthApiError: Invalid login credentials]}

For unconfirmed accounts:
{"data": {"session": null, "user": null}, "error": [AuthApiError: Email not confirmed]}

In scenarios where a user registers but hasn't yet confirmed their email, this "Email not confirmed" string is used in the response. However, this string is subject to change in future updates, making it less reliable for developers to build upon.

I propose that Supabase consider implementing a more standardized status code approach in the response, in addition to or instead of the current error messages. For instance:

For invalid credentials, a status code of 401:
{"data": {"session": null, "user": null}, "error": [AuthApiError: Invalid login credentials], "status": 401}

For unconfirmed accounts, a status code of 435:
{"data": {"session": null, "user": null}, "error": [AuthApiError: Email not confirmed], "status": 435}

By using standardized status codes, developers can rely on consistent responses and don't have to rely on parsing error message strings, which can change over time.
GitHub
I'd like to open a discussion regarding the current response structure in supabase.auth. Currently, when making requests related to user authentication, we receive JSON responses that look like...
Was this page helpful?