auth
auth copied to clipboard
Add well-defined error codes
Feature request
Is your feature request related to a problem? Please describe.
Currently it appears that errors from GoTrue only contain a single property, msg
, which describes the error. While I could show this message to my users, it would not be localized, and may not match the tone of my app.
Describe the solution you'd like
I would like it if there were well-documented specific error codes (beyond the HTTP error codes) like PASSWORD_TOO_SHORT
or EMAIL_EXISTS
included in error payloads so that I could create my own error messages to present to the user on the application side.
Describe alternatives you've considered
I could match against the existing msg
strings, but that seems error-prone and likely to be broken when the language in those strings is updated.
After further development, I've discovered that some errors do include error codes (GoTrueError(message: nil, msg: nil, code: nil, error: Optional("invalid_grant"), errorDescription: Optional("Invalid login credentials")
) while others do not (GoTrueError(message: nil, msg: Optional("Password should be at least 6 characters"), code: Optional(422), error: nil, errorDescription: nil)
.
This is a known issue and one we're very aware of. It is likely to be one of our biggest priorities in the next year. We'll keep you updated on this issue.
Any news on this topic? I'm building a Rust app and it's extremely confusing what the API error messages come in different shapes.
Working on it, main PR here: #1377
It appears @hf PR was merged, shouldn't this issue be closed then?
yes you can close
Em seg., 15 de abr. de 2024 às 07:58, Fatuma Abdullahi < @.***> escreveu:
It appears @hf https://github.com/hf PR was merged, shouldn't this issue be closed then?
— Reply to this email directly, view it on GitHub https://github.com/supabase/auth/issues/842#issuecomment-2056550054, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQH3JUIDWJLDYH3OL3NCG6LY5OXG5AVCNFSM6AAAAAASRFKETGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJWGU2TAMBVGQ . You are receiving this because you commented.Message ID: @.***>