Warm tip: This article is reproduced from serverfault.com, please click

Export users with credential in keycloak with Admin Console API

发布于 2020-12-10 09:42:13

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

this is the result of endpoint not contains the credential

 {
    "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 ?

Questioner
c'est moi
Viewed
0
dreamcrash 2020-12-10 22:24:54

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