keycloak/keycloak-nodejs-admin-client

findOne by username return array

DiV666 opened this issue · 2 comments

Hi,

When i use findOne method with username param it's return array of UserRepresentation

const user = await kcAdminClient.users.findOne({ username: 'test' });

console.log(user);
[
  {
    "id": "4c1aabe8-8307-404d-818b-721ddc507d44",
    "username": "test",
    ...
  }
]

Is this the expected behavior?

When i use findOne with id param, return UserRepresentation Object

This is pretty much applicable to a number of other methods, the array should be converted to a single object instead

the way findOne works is when you specify an id if you don't use an id then it's a regular find.