[keycloak-user] Credentials on create a new user.

Chris Hairfield chairfield at gmail.com
Fri Mar 4 21:22:33 EST 2016


I've been encountering the same issue with 1.4.0 and 1.6.1 and assume it's
by design. I believe I've come across past threads confirming this.

My solution is to first create the user, then hit the reset password API,
and, as a final and optional step, update the user with an empty
requiredActions array to clear the Update Password action inherent in the
reset password flow.

Hopefully someone that is more sure can step in to confirm.

On Fri, Mar 4, 2016, 11:38 AM Thiago Leonardo <thiagoleocosta at gmail.com>
wrote:

> Hi,
>
> I'am trying create a new user in admin-client, but the credentials are not
> saved.
> The new user is saved normaly. Can you help me ?
>
> My code is:
>
> Keycloak kc = KeycloakBuilder.builder()
> .serverUrl("http://localhost:8080/auth")
> .realm("Realm")
> .username(username)
> .password(password)
> .clientId("admin-cli")
> .resteasyClient( new
> ResteasyClientBuilder().connectionPoolSize(10).build() )
> .build();
>
> UserRepresentation newUser = new UserRepresentation();
> newUser.setUsername(user.getEmail());
> newUser.setFirstName(user.getName());
> newUser.setEmail(usuario.getEmail());
> newUser.setEnabled(true);
>
> CredentialRepresentation credential = new CredentialRepresentation();
> credential.setType(CredentialRepresentation.PASSWORD);
> credential.setValue(user.getEmail());
> credential.setTemporary(true);
>
> newUser.setCredentials(Arrays.asList(credential));
> kc.realm("Realm").users().create(newUser);
>
>
> Regards,
>
> Thiago
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160305/2236c0cc/attachment-0001.html 


More information about the keycloak-user mailing list