Group membership is returned as part of the token, so you might simply check that. If you do need a separate call, use the /me/memberOf endpoint, or the /me/transitivememberof one.
Access Membership Graph API, but need admin consent
I have a web app, wants to check if the logged-in user belongs to a group so that I can control the permission of the group and users for my web app.
Checked Graph API has https://learn.microsoft.com/en-us/graph/api/group-getmembergroups?view=graph-rest-1.0&tabs=http. I think it meets my requirement.
However the api needs permission: GroupMember.Read.All, Group.Read.All, Directory.Read.All, Directory.ReadWrite.All, Directory.AccessAsUser.All.
When I configured the permission in AAD, it tells all these permission needs Admin Consent, but I can't grant.
So how can we get admin consent granted. If this API is not proper way to check membership, is there any other way to implement such senario?
Many thanks,
Ping
Microsoft Security Microsoft Graph
1 answer
Sort by: Most helpful
-
Vasil Michev 119.5K Reputation points MVP Volunteer Moderator
2021-05-21T10:30:45.657+00:00