首页 > 解决方案 > 使用 _claim_sources 检索组声明返回指定的 api-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。

标签: c#asp.net-coreazure-active-directoryopenid-connectclaims-based-identity

解决方案


您应该将版本 附加?api-version=1.6到端点。在此处查看完整的代码示例。


推荐阅读