[keycloak-user] changing password not working with api

Juan Diego juandiego83 at gmail.com
Fri Jan 5 11:28:53 EST 2018


Hi,

I did some tests months ago, and I was pretty sure the following code
worked.  Now when I am trying to implement a password change it doesnt
work. I am using basically the same  way to change the last name of the
users, and it works. I can see the last name change in the keycloak
server.  But when i try to login to the user that i just changed the
password I have to use and the old password.

Anyway this is my code:


UserResource ur = kc.realm(realm).users().get(id);
        UserRepresentation user = ur.toRepresentation();

CredentialRepresentation credential = new CredentialRepresentation();
credential.setType(CredentialRepresentation.PASSWORD);
credential.setValue(password);
credential.setTemporary(false);
user.setCredentials(asList(credential));

ur.update(user);


More information about the keycloak-user mailing list