When the user logs in through /auth/authenticate with an invalid email address, the API returns with an error code 4 with a message of email: This value is not a valid email address..
Authentication errors are all scoped in the 100 range, except for the 422 error on auth. Should we add a 0109 error code for the "Invalid email provided" error?
Theoretically when logging in, you should never see "Email is invalid" or "Password is invalid", however, "Email or Password is invalid" would be okay imo.
That's already the case @shealavington. This error is not for "wrong username/password" this is for invalid payloads eg an email that's "rijk#rngr.org" or a password that's empty.
To clarify,
4XX (like 422) are HTTP STATUS code100 (like Authentication errors, and other errors) are Directus defined error code To make cleaner error code, as @WoLfulus suggested on #1104
Instead of using numbered error code (like 0100, 0101) we can use the text (like EMAIL_NOT_FOUND, INVALID_TOKEN)
And along with text error code, we also supply the appropriate HTTP STATUS code.
Additionally, we can create one endpoint (like GET /errors) to list out all the possible error code along with messages. So App can use that endpoint and display user-friendly error msg.
I like the idea of using string based error codes, but that doesn't negate this original request 馃槈
Additionally, we can create one endpoint (like GET /errors) to list out all the possible error code along with messages. So App can use that endpoint and display user-friendly error msg.
I think we don't need this, all the error codes will have a description in the languages files in the Directus app itself. The API doesn't have any localization, so those strings won't be used most likely
Fixed in #1218
Most helpful comment
Theoretically when logging in, you should never see "Email is invalid" or "Password is invalid", however, "Email or Password is invalid" would be okay imo.