Keycloak Authorization APIs to create Policies, Permissions and Resources

Hi,

I have tired to create resource set using the below API and resources are getting create. these resources are visible in admin screen under Authorization → resources

POST https://server/auth/realms//authz/protection/resource_set

However, we have tried to create policy using the below API and the policy is not visible under Authorization policies
POST https://server/auth/realms//authz/protection/uma-policy

Can you please help on the correct API end points to create/update/delete/get Resources, Scopes, Polices and Permission in Keycloak.

Appreciate your help on this. Thanks

1 Like

Hi,
I Use keycloak java api for resource/policy/permission creation.

If you want to use Rest directly, check keycloak admin gui - it calls Rest api behind the scenes. Just do Inspect in browser and then check network traffic.

1 Like

Thanks Andriusk, I will check the APIs in browser and will update you.

Hi Andriusk,

yes, we can get APIs details in browser when we add resource/policy/permission in Admin Console. Thanks for you help.

regards
Karthik

Hey, did you able to create the Policies with API?
I still didn’t able to do it. Even copying the request as it is from GUI, always getting unknown_error 403 forbidden

All other requests works as expected…

Hi Andriusk , Can you share the java API you have been using to create token-exchange permission/policy ?
I have been trying to create the token exchange permission/policy and couldn’t achieve it through java api in v21 .
Thanks in advance.

To resolve the 403 error, see my reply here:

How do I create policies via API - Miscellanaeous - Keycloak