Reputation: 567
I am trying to get the permissions that is added for the user in my keycloak realm client. But i am not able to get the authorization information in introspection API.
Following are the steps I did to fetch the authorization information.
Step 1: Get users access token
To get the access token i am calling the API,
API:
{{base_path}}/realms/{{realm_name}}/protocol/openid-connect/token
Body:
client_id:democlient
client_secret:xxxxx
grant_type:password
username:testuser
password:123
and its response is,
{
"access_token": "XXXXXXXXXX",
"expires_in": 300,
"refresh_expires_in": 1800,
"refresh_token": "XXXXXXXXXX",
"token_type": "Bearer",
"not-before-policy": 0,
"session_state": "c3e7fddc-e38f-4519-b2c3-d6917e0ebae8",
"scope": "email profile"
}
Step 2: Get authorization token
To get the authorization token i am calling the following API,
API:
{{base_path}}/realms/{{realm_name}}/protocol/openid-connect/token
Header:
Authorization:Bearer {{access_token}}
Body:
audience:democlient
grant_type:urn:ietf:params:oauth:grant-type:uma-ticket
and the response is like,
{
"upgraded": false,
"access_token": "XXXXXXXXXXXXXX",
"expires_in": 300,
"refresh_expires_in": 1800,
"refresh_token": "XXXXXXXXXXXXXX",
"token_type": "Bearer",
"not-before-policy": 0
}
Step 3: Call Introspection with authorization token
Now called the introspection API with authorization token got from previous step,
API:
{{base_path}}/realms/{{realm_name}}/protocol/openid-connect/token/introspect
Body:
client_id:democlient
client_secret:XXXXXXX
token:{{authorization_token}}
From this I got the introspection response without authorization
key.
When I decode the JWT token from step 2 access_token
I can see authorization
key and all the permissions under it. But not available in introspection API response. So, what am i doing here wrong?
Upvotes: 0
Views: 21