stormpath / stormpath-sdk-java

Official Java SDK for the Stormpath User Management REST API
222 stars 155 forks source link

Localization of password-change errors with OktaError? #1345

Open george-hawkins-work opened 7 years ago

george-hawkins-work commented 7 years ago

When a user attempted to change their password with the old Stormpath backend we used to get back a code, e.g. 2007 for "password too short", and we could then map this code to localized text for the end user.

Now with the Okta backend ResourceException.getCode() always returns 0. We can call e.getStormpathError().getMessage() and get something like:

password: Password requirements were not met. Your password must have at least 8 characters, a lowercase letter, an uppercase letter, a number, no parts of your username.

This maybe useful for our internal logging but we can't just pass this on to non-English end users. Scanning the error text for strings like "requirements were not met" is obviously not the way to go - can we get codes similar to those provided by the old Stormpath backend that can properly be mapped to localized error messages?