Access Membership Graph API, but need admin consent

Ping Li 1 Reputation point Microsoft Employee
2021-05-21T09:24:56.22+00:00

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. 98519-1.png

When I configured the permission in AAD, it tells all these permission needs Admin Consent, but I can't grant.
98611-2.png

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
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vasil Michev 119.5K Reputation points MVP Volunteer Moderator
    2021-05-21T10:30:45.657+00:00

    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.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.