[keycloak-dev] Importing credentials via API

Thomas Darimont thomas.darimont at googlemail.com
Wed Jun 7 15:59:58 EDT 2017


Hello Machiel,

you need to use the resetCredential(..) endpoint of a user resource,
e.g.: userRessource.get(userId).resetPassword(passwordCred);

Here is an complete example for the Keycloak AdminClient:
https://gist.github.com/thomasdarimont/0c136d0b8d339b997928e9bef225f941
which shows how to:
- create a user
- set user attributes
- assign roles (realm roles as well as client specific roles)
- set a password

Cheers,
Thomas

2017-06-07 14:20 GMT+02:00 Machiel Groeneveld <machielg at gmail.com>:

> Hi,
>
> I’m currently migrating a legacy database to Keycloak. I’m importing the
> users via the REST API. Now I’ve run into the issue that credentials are
> not stored when the user is created. The code doesn’t seem to invoke any
> calls related to credentials. The code does exist but is only invoked
> during the file import (or partial import).
>
> Is it an option to add the credential processing to the
> UsersResource.createUser() ?
>
> I’ve also created an issue https://issues.jboss.org/browse/KEYCLOAK-5026 <
> https://issues.jboss.org/browse/KEYCLOAK-5026>
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev


More information about the keycloak-dev mailing list