I have registered both an angular app and an Asp.Net core web API to Azure Active Directory. I've add an app role to the registration of the Angular. I also assigned the role to one user.
When I log the user in, the I don't see the roles property in the Access Token. All I see this "scp": "Directory.Read.All openid profile User.Read email",
.
The role property appears in the id token. like this:
"roles": [
"can_read_own_application"
],
Why is this role appearing in the id_token
instead of the access_token
, given that the access_token is the one the API is expecting.
By the way, there are countless documentation on the subject. I just watched this video made by MS employees. I can't find where it says whether the app roles should be added to the client app or the API app. Maybe my that's why the roles is not appearing in the access token. However, the app roles added to the API registration are not even coming in the token.
Thanks for helping.
EDIT
"knownClientApplications": ["351d2a1d-fb5f-4527-b614-edb6d7277043" ]
- I updated the permission to the API for the client
- I updated my angular code
Now when I log in, the above scope is nowhere to be found. The access token has this value:
{
"app_displayname": "MyApplication-Client-Local",
//..
"scp": "openid profile User.Read email",
}
I don't even remember to have asked for the openid
and email
. The scope I mentioned are User.Read
and access_as_user
.