使用 _claim_sources returns 检索组声明 指定的 api 版本无效。该值必须与受支持的版本完全匹配

Retrieve group claims using _claim_sources returns The specified api-version is invalid. The value must exactly match a supported version

我想从 Azure Active Directory 中检索登录用户的组声明。我在 Azure 门户

的应用程序清单中启用了组检索
"groupMembershipClaims": "All"

群组数量超出限制,我收到的是这些声明:

_claim_names:   {"groups":"src1"}
_claim_sources: {"src1":{"endpoint":"https://graph.windows.net/12345678-0939-496d-b129-198edd916feb/users/{user-object-guid}/getMemberObjects"}}

然而,当我向声明中指定的端点发出 POST 请求时,我得到:

{
  "odata.error": {
  "code": "Request_DataContractVersionMissing",
  "message": {
    "lang": "en",
    "value": "The specified api-version is invalid. The value must exactly match a supported version."
    }
  }
}

如何正确请求群组声明?我可以使用 https://graph.microsoft.com/v1.0/me/getMemberObject,但它需要额外的权限以及为什么在声明中会有另一个 URI。

您应该附加 version ?api-version=1.6 to the endpoint. See a complete code sample here.