I am using Keycloak 20.0.5, and for some reason API call to /admin/realms/my-realm/users/
return 403. I have added all roles to my client, my configurations is as follow
Client roles, I have added all available roles just to test
My JS admin client code
import KcAdminClient from '@keycloak/keycloak-admin-client';
(async() => {
const kcAdminClient = new KcAdminClient();
kcAdminClient.setConfig({
baseUrl: 'http://localhost:8080,
realmName: 'my-realm',
});
// Authorize with username / password
await kcAdminClient.auth({
clientSecret: 'xxx',
grantType: 'client_credentials',
clientId: 'management-client',
});
// List all users
try {
const users = await kcAdminClient.users.find();
console.log(users);
} catch (error) {
console.log(error.message);
}
})();
It returns 403 error, even if I use Postman to get the token from /realms/my-realm/protocol/openid-connect/token
and use the token returned from that API to /admin/realms/my-realm/users/
it still return 403