Reputation: 537
I have created a client in keycloak and configure it access type to "confidential".
I can use REST API protocol/openid-connect/token
with clientId and client secret to get the access token for this this client.
In my design, there is a use case that I need to use the client access token to post a role in its Realm (the role needs to belong to realm, not this client). Then I can see the post request is denied. I have configured the scope of this client to full scope but it doesn't help.
Any idea whether this is possible? If yes, what configs I need for this client?
Upvotes: 4
Views: 1858
Reputation: 51393
Try the following:
(OLD Keycloak UI)
Service Accounts Enabled
to ON
, and click [SAVE]
;Service Accounts Roles
tab;Client Roles
dropdown menu select the realm-management
clientrealm-admin
, and click Add Selected
and tried it out.(New Keycloak UI)
Clients
and select your client;Service accounts roles
and click [SAVE]
;Service Accounts Roles
tab;Assign Role
Search by role name
search for the role name 'realm-admin', then select it and click on Assign
Upvotes: 6