[keycloak-user] assign client roles to a user using keycloak rest API

Dimitris Charlaftis dharlaftis at ekt.gr
Mon Feb 4 04:39:40 EST 2019


I want to assign a client role to a specfic user using keycloak rest API.

 From the documentaion, i tried this:

I have a realm called internal_applications and a client under this 
realm called test_app. In this client (test_app), I have manually 
created some client roles, i.e. administrator.

Then, I hit the server with postman

HTTP POST http://<keycloak-server-url>/auth/admin/realms/<realm-name>/users


"username": "jim at ka.gr <http://ka.gr/>",
"firstName": "Jim",
"lastName": "Sanders",
"email": "jim at ka.gr <http://ka.gr/>",
"clientRoles": {
"test_app": ["administrator"]


This http call adds the user jim at ka.gr to keycloak, but DOES NOT ASSIGN 
the already existing client role administrator to him.

How can I do this?

Please, help...



Dimitris Charlaftis
Software Engineer

National Documentation Center
email: dharlaftis at ekt.gr

This email has been checked for viruses by AVG.

More information about the keycloak-user mailing list