Noam
Noam

Reputation: 1804

Microsoft Graph - get admin details after consent

I'm having Microsoft app who asks for User.ReadWrtie.All permission through admin consent page.

After the admin of an organization gave his consent, he is being redirected to url I decide, and I get tenant value in request which I can use in order to acquire token and preform actions.

So far so good. Is there a way to get the admin details (first name, email, company name etc)?

I'm guessing that permission wise I have the permission to know this information, but in the docs (get user documentation) it seems like I must provide userPrincipalName (which I don't know) in order to get these details.

Is it possible to get the admin details some how? even if it means sending more than one request...

Upvotes: 0

Views: 248

Answers (1)

Tony Ju
Tony Ju

Reputation: 15619

Is it possible to get the admin details some how?

We will not know the admin who gave the consent. You need to provide the userid/userPrincipalName to get the user details.

GET https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}

Upvotes: 2

Related Questions