I have created a Azure AD web application. Now I am getting my access_token using following API,
POST
https://login.microsoftonline.com/{Directory (tenant) ID }/oauth2/v2.0/token
password:pass
client_id:id
resource:https://graph.microsoft.com
grant_type:password
client_secret:secret
sername:userName
scope: https://rbsessence.onmicrosoft.com/0a7c94a0-0c4e-4f95-ba06-XXXX/.default
The response looks like,
"token_type": "Bearer",
"scope": "https://rbsessence.onmicrosoft.com/0a7c94a0-0c4e-4f95-ba06-XXXXX/myTestRole https://rbsessence.onmicrosoft.com/0a7c94a0-0c4e-4f95-ba06-XXXXXX/user_impersonation https://rbsessence.onmicrosoft.com/0a7c94a0-0c4e-4f95-ba06-XXXXX/.default",
"expires_in": 3599,
"ext_expires_in": 3599, "access_token": "acessToken"
Now I am passing the access_token to a third party application which is configured with the same Azure AD client. Now that third party is expecting a custom claim by the name "policy":"readwrite"
, to be passed as part of access_token. How can I achieve the same?