如何从 Azure openid 获取组织名称?

How to get Organization name from Azure openid?

我想使用单点登录为 Azure 市场构建 SAAS 服务。

我已阅读此文档 Microsoft identity platform access tokens,但找不到任何与用户组织相关的内容。

有什么方法可以获取用户的组织名称吗?

现在我只能从电子邮件中解析。

您可以调用 MS Graph API 获取用户的组织详细信息:https://docs.microsoft.com/en-us/graph/api/organization-get?view=graph-rest-1.0&tabs=http

终点在https://graph.microsoft.com/v1.0/organization

响应示例:

{
  "@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"
    }
  ]
}

即使有基本的 User.Read 权限,您也可以调用此端点。