I am facing few issues with respect to oauth2 in azure.
I have configured App registration exposing two scopes something like API.READ.ALL and API.WRITE.ALL
Also i have added two APP Roles API.READER and API.WRITER
Now i have registered the client APP assigning it the permission of API.READ.ALL and API.READER
Issue 1.
Now when i generate the token, token doesn't contains scp(scope) element or any other element denoting the scope.
Issue 2.
In the roles claim i see both API.READER and API.WRITER roles even though i expected only assigned API.READER role
This is how i use to generate token from POSTMAN
https://login.microsoftonline.com/<tenantId>/oauth2/v2.0/token
clientId: <client app id>
client secret: <client secret>
scope: api://<app id>/.default
Grant Type: Client Credentials
Client Authentication: Send Client credentials in the body
This is the token receieved after decoding it in jwt.io
{
"aud": "<app id>",
"iss": "https://login.microsoftonline.com/<tenantId>/v2.0",
"iat": 1612310376,
"nbf": 1612310376,
"exp": 1612314276,
"aio": "<value>",
"azp": "<client id>",
"azpacr": "1",
"oid": "<value>",
"rh": "<value>",
"roles": [
"API.WRITER",
"API.READER"
],
"sub": "<value>",
"tid": "<tenantId",
"uti": "<val>",
"ver": "2.0"
}
See there is no value for the scope in the token and also roles contains both the roles. Please advice what needs to be done.