[keycloak-user] Admin REST New User Client Roles

Sven Thoms sven.thoms at gmail.com
Fri Mar 10 10:07:43 EST 2017


I am having trouble adding a default client role when posting a new user to
the ADMIN REST interface.
According to one data migration code, it would work:

https://github.com/keycloak/keycloak/blob/1aeec2a83c6677cd7dcfccb6ba2c39
d10143b920/examples/authz/photoz/photoz-realm.json


curl -v -X POST \
 -H "Content-Type:application/json" \
 -H 'Authorization: bearer xxxx' \
 -d '{
         "username": "my_user",
         "enabled": true,
         "credentials": [
         {
           "value" : "my_password",
           "temporary" : false
         } ],
         "realmRoles": [
        "offline_access", "uma_authorization"
         ],
         "clientRoles": {
        "realm-management": [
          "view-clients"
        ]
        }
     }' \
 https://mydomain/auth/admin/realms/myrealm/users


The new user is created, but role mappings are not assigned. Is this
another case of Admin REST API and AuthZ not working together?


More information about the keycloak-user mailing list