[keycloak-user] [Keycloak-admin-client] An error message when changing password.
Dmitry Telegin
demetrio at carretti.pro
Mon May 27 18:35:03 EDT 2019
Privet, Alexey :)
Here's how password reset is done with Keycloak Admin REST API, assuming password policy violation:
> PUT http://localhost:8080/auth/admin/realms/master/users/{user-id}/reset-password
> {"type":"password","value":"foo","temporary":false}
< 400 Bad Request
< {"error":"invalidPasswordMinLengthMessage","error_description":"Invalid password: minimum length 8."}
If I understand correctly, you get a javax.ws.rs.BadRequestException from the Java admin client. You could try calling getResponse().getEntity() on the exception object to obtain JSON response.
Cheers,
Dmitry Telegin
Carretti Consulting OÜ | Keycloak Consulting and Training
Sepapaja 6, Tallinn 15551, Estonia | info at carretti.pro
On Mon, 2019-05-27 at 14:51 +0700, Алексей Виноградов wrote:
> Hello everyone.
>
> I have a question about REST API of the Keycloak. When I attempt to change
> password via REST API of user to that password that not meets security
> constraints of Keycloak, I recieve BadRequestError without additional
> information of what goes wrong. But when I change password in
> Administration console I see an exact error.
>
> So, how can I get a exact problem what wrong with my password?
>
> My usecase is that:
> I have a frontend (html/css) that communicates with a backend that
> communicates with the Keycloak. An user wants to change password of his/her
> account so he/she click on button on some form, and makes a request to
> backend to change password. A backend processes that request and ask
> Keycloak to change user password. In case that password doesn't meet
> security constraint I want to provide to user exact error.
>
> Thanks to all.
> --
More information about the keycloak-user
mailing list