Getting user credentials list in admin api

Hello everyone,

is there a way to know if a user has a password set? I’m using the keycloak-admin npm package, when I get a single user I have:

{
  id: '18d50049-3eee-44f4-8d1f-26d281659d89',
  createdTimestamp: 1597114304501,
  username: 'a@a.com',
  enabled: true,
  totp: false,
  emailVerified: true,
  firstName: 'A',
  lastName: 'B',
  email: 'a@a.com',
  disableableCredentialTypes: [],
  requiredActions: [],
  notBefore: 0,
  access: {
    manageGroupMembership: true,
    view: true,
    mapRoles: true,
    impersonate: false,
    manage: true
  }
}

and it doesn’t return the list of credentials.

Is there a way to do so?

Hi Alex,

Depending on what version of keycloak you are using, there is a GET /{realm}/users/{id}/credentials API call: https://www.keycloak.org/docs-api/9.0/rest-api/index.html#_credentialrepresentation

1 Like

Oh my, I’ve no idea how I was able to miss that.

Thanks @mahen!

Oh it seems that the keycloak-admin package doesn’t support that

I’ll just make a custom request then

1 Like