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

问题描述 投票:0回答:1

我想从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-core azure-active-directory openid-connect claims-based-identity
1个回答
1
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.