Reputation: 359
How to export users with credential in keycloak using Admin Console API
I used this endpoint but it not contains the credential of users
curl -X GET https://$KEYCLOAK_IP/auth/admin/realms/$REALM_NAME/users
{
"id": "dbede89b-dbf8-4b4b-84a6-da7b6c1877e3",
"createdTimestamp": 1607591201217,
"username": "admin",
"enabled": true,
"totp": false,
"emailVerified": false,
"disableableCredentialTypes": [],
"requiredActions": [],
"notBefore": 0,
"access": {
"manageGroupMembership": true,
"view": true,
"mapRoles": true,
"impersonate": true,
"manage": true
}
},
How can I recover users with credential ?
Upvotes: 2
Views: 12071
Reputation: 51523
No, using that endpoint alone will not return you back the user credentials. You can, however, import the users with the credentials using the endpoint:
PUT https://$KEYCLOAK_IP/auth/admin/realms/$REALM_NAME/users
To export the users with their passwords, you can instead pass the option -Dkeycloak.migration.action=export
during the keycloak started up:
bin/standalone.sh -Dkeycloak.migration.action=export
and similarly for import just use -Dkeycloak.migration.action=import
.
You can read in much more detail about this option on Red Hat documentation and/or in this blog
Upvotes: 6