Reputation: 43
I need to check whether authenticated user is present in the group or not, So we need to make a call as below:
POST https://graph.windows.net/myorganization/isMemberOf?api-version
Content-Type: application/json
{ "groupId": "5e624f44-d38d-4943-b07c-2bad078f52ff",
"memberId": "ea59e4d3-a7a1-4b5b-b65f-a25fcc0c0f99" }
From where do we get the memeberId from the this.adalService.userInfo after user is authenticated. Below is the response I got, from the below response is there any property belong to memeberId.
Upvotes: 0
Views: 396
Reputation: 58898
It's definitely the user's object id. In this case it is the oid
claim. In your image: this.adalService.userInfo.profile.oid
.
More info on claims in ID tokens can be found here: https://learn.microsoft.com/en-us/azure/active-directory/develop/active-directory-token-and-claims#idtokens
oid
Object ID
Contains a unique identifier of an object in Azure AD. This value is immutable and cannot be reassigned or reused. Use the object ID to identify an object in queries to Azure AD.
That function can be used to check group membership for users, groups, contacts or service principals. In all cases the memberId should be the objectId of the corresponding object.
Though it seems you are receiving member groups in the groups
claim, why not use that?
Upvotes: 1