howie
howie

Reputation: 2695

How to get Organization name from Azure openid?

I want to build a SAAS Service for Azure marketplace using single-sign-on.

I have read this document Microsoft identity platform access tokens, but can not find anything relate to User's Organization.

Is there any way to get user's Organization name?

For now I only can parser from email.

Upvotes: 0

Views: 465

Answers (1)

juunas
juunas

Reputation: 58823

You can call MS Graph API to get the user's organization details: https://learn.microsoft.com/en-us/graph/api/organization-get?view=graph-rest-1.0&tabs=http.

The endpoint is at https://graph.microsoft.com/v1.0/organization

Sample response:

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#organization",
  "value": [
    {
      "assignedPlans": [
        {
          "assignedDateTime": "datetime-value",
          "capabilityStatus": "capabilityStatus-value",
          "service": "service-value",
          "servicePlanId": "servicePlanId-value"
        }
      ],
      "businessPhones": [
        "businessPhones-value"
      ],
      "city": "city-value",
      "country": "country-value",
      "countryLetterCode": "countryLetterCode-value",
      "displayName": "displayName-value"
    }
  ]
}

You can call this endpoint even with the basic User.Read permission.

Upvotes: 1

Related Questions