How to add user with client roles using rest api

Hello sir. I got problem with this case. How to add user with client roles like realm-management with manage-users using rest api. My request was success but new user have not assign client role

$response = $http
->post(config(‘services.keycloak.uri’) . ‘/auth/admin/realms/SPBE/users’, [
‘headers’ => [
‘Content-Type’ => ‘application/json’,
‘Authorization’ => 'Bearer ’ . $bearer_token,
],
‘body’ => json_encode([
‘firstName’ => $data->name,
‘email’ => $data->username,
‘enabled’ => true,
‘username’ => $data->username,
‘credentials’ => [[
‘type’ => ‘password’,
‘value’ => $random_password,
‘temporary’ => false,
]],
‘clientRoles’ => [
‘account’ => [‘manage-account’]
],
]),
]);

Keycloak v11.0.3

Please help me

1 Like

@deerand Any luck on this?

@deerand did you find any solution regarding to this issue?