Our requirement is to enable users to create their own OIDC/OAuth2 clients with a definite scope.
We have a web application that was integrated with Keycloak with a client say “AppClient” with which users authenticate and get their OIDC Token, Access token.
We also have another client say “AppAdmin” of the type service account grant enabled (client credentials) with service account roles “Create client, Manage Client”.
Now we are trying to exchange the user’s access token from AppClient and getting a new access token for the “AppAdmin” Client but With this exchanged token I am not able to create/register a new client.
Getting error response as insufficient_scope.
Very much appreciate it if you can please advise on how to achieve our use case.
Using the grant type = password on “ClienAdmin”, get an access token and tried to register a new client, getting an insufficient_scope error
Using the grant type =client_credentials on “ClientAdmin”, Got an access token and registered a new client successfully.
I suspect, the client_credentials grant type only can fetch the entitlements from the service account roles and push them into the access token.
The access tokens generated with other grant types will not get those entitlements and so failing while creating/registering the new client.