Repository navigation
|
I have a RESTful API that is consumed by a browser frontend and multiple machine-to-machine clients. So I'm issuing tokens with Keycloak 18 through Standard Flow (Authorization code) and Service Account Flow (Client credentials). The operations on the API's resources are protected by scopes like read:resourceA, update:resourceA, read:resourceB, etc. When I assign a Realm Role to a Client Scope, and if I map a user to the same Realm Role, the tokens issued through the Authorization Code Flow (browser frontend) contain the scope. Also, when I create a Machine-to-Machine client and I add the Client Scope directly to the Client, the tokens for the M2M client also contain the scope. So far so good. But as soon as I try to do both at the same time, I no longer have the scope in tokens issued by the M2M-client. It seems that adding a Client Scope to a Role makes it impossible to use that scope otherwise. The obvious, but bad solution would be to create a second set of scopes for this kind of client. Is there any other solution I'm not aware of? I'm migrating from Auth0.com to Keycloak, and there I can do this, because permissions are assigned to the API. So I'm wondering if I'm missing something here. Thanks a lot, |
Replies: 1 comment
|
Found the solution. It turns out that I completely missed the concept of For those running into the same trouble: How to add a new Role to an Authorization code flow client
Add the new client role to the user
|
Found the solution. It turns out that I completely missed the concept of
Service Account Roles.For those running into the same trouble:
How to add a new Role to an Authorization code flow client
Add the new client role to the user