I am seeing a keycloak documentation on listing as roles and the example is:
Get all roles for the domain or client
GET / {region} / customers / {id} / roles
Does anyone have a practical example for listing as roles using “curl or postman”
Original Doc: https://www.keycloak.org/docs-api/5.0/rest-api/index.html#_roles_resource
Appreciate
zonaut
2
Where do you get that region and customers string in the path, the docs says GET /{realm}/clients/{id}/roles
Yes I would like an example of how to do this using a tool with Curl or. Postman
zonaut
4
Here is an example on how you could do this with curl, put it in a bash script.
DIRECT_GRANT_RESPONSE=$(curl -i --request POST "http://localhost:8080/auth/realms/master/protocol/openid-connect/token" --header "Accept: application/json" --header "Content-Type: application/x-www-form-urlencoded" --data "grant_type=password&username=admin&password=password&client_id=admin-cli")
ACCESS_TOKEN=$(echo $DIRECT_GRANT_RESPONSE | grep "access_token" | sed 's/.*\"access_token\":\"\([^\"]*\)\".*/\1/g');
curl --request GET "http://localhost:8080/auth/admin/realms/realm-name/clients/client-id/roles" --header "Accept: application/json" --header "Authorization: Bearer $ACCESS_TOKEN" | python -m json.tool;
Thank you . But when I try I get the message.
error": “HTTP 401 Unauthorized”
zonaut
7
/{realm}/clients/{id}/roles your url is incomplete, role -> roles