'Keycloak user authorization openid-protocol Rest API

i am new to keycloak. I have made web portal that authentication (login, logout,forgot password) of users is done in backend ( PHP ) using REST Api. After successful authentication user is allowed to enter secure part of portal. I am having trouble to get REST API endpoint so that when user is logged in i would like to get a list of permissions that this user have so i can render the UI with functions that specific user have permissions to. So far i found endpoint which can ask for specific permission only

curl -X POST   http://$URL/auth/realms/argo/protocol/openid-connect/token  -H "Authorization: Bearer $TOKEN" --data "audience=$CLIENTID"  --data "permission=$PERMISSIONNAME#$PERMISSIONSCOPE"

Is this possible with keycloak ? I would have maybe around 10 navigation functions and some will be payable so once user buys this function we will allow this permission to this specific user.

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source