User-friendly error messages for Kratos API endpoint 400 responses
Preflight checklist
- [X] I could not find a solution in the existing issues, docs, nor discussions.
- [X] I agree to follow this project's Code of Conduct.
- [X] I have read and am following this repository's Contribution Guidelines.
- [ ] This issue affects my Ory Cloud project.
- [X] I have joined the Ory Community Slack.
- [x] I am signed up to the Ory Security Patch Newsletter.
Describe the bug
When calling the Kratos adminCreateIdentity endpoint, the 400 response error messages are not quite user-readable.
For example, having an email in the identity schema, mark is required and filling it as an empty string produces the following response:
code: 400
message: "The request was malformed or contained invalid parameters"
reason: "I[#/traits/email] S[#/properties/traits/properties/email/format] "" is not valid "email""
request: "1c475a8b6751ddc7ee6ced7232a13449"
Also, see this conversation on Slack: https://ory-community.slack.com/archives/C02PSRUGUAV/p1660570115446989
Version
Helm chart 0.23.1 and Kratos v0.9.0-alpha.3
On which operating system are you observing this issue?
Linux
In which environment are you deploying?
Kubernetes with Helm
Additional Context
A proposed solution is to re-use the code that creates the error messages for other flows and insert it for all relevant Kratos endpoints. For example, when using the kratos-self-service-UI-react-next, the <Flow/> component already receives and presents these messages user-friendly.
Good point, we for sure need to improve this!
Any updates on this particular issue? 🚢