【发布时间】:2020-07-09 11:59:42
【问题描述】:
我是 Microsoft Graph API 的新手,我们需要提取通过 Azure AD B2C 策略登录的用户的身份验证方法。
用户在登录后通过身份验证,但是,当从应用程序调用以下代码时遇到“401 - 未授权”并显示“用户未通过身份验证”。
图形 API
https://graph.microsoft.com/beta/me/authentication/methods/
应用中的错误:
AggregateException: One or more errors occurred. (Error Calling the Graph API:
{
"error": {
"code": "unauthenticated",
"message": "The user is unauthenticated.",
"innerError": {
"message": "The user is unauthenticated.",
"date": "2020-07-09T11:07:29",
"request-id": "bea50bdf-28f6-4a67-a5a4-3aacd8f23251"
}
}
})
我还在 Azure 的应用注册中提供了适当的 API 权限。
Type: Delegated
Permission: UserAuthenticationMethod.Read, UserAuthenticationMethod.Read.All
我在这个documentation 中遇到了“应用程序”不受支持。
截图: Permission
问题:
我能否知道这是否是我遇到“401 - 已授权”并显示“用户未经身份验证”错误的原因,因为尚不支持从应用程序中提取身份验证方法? 或者可能缺少我尚未考虑的权限。
谢谢。
【问题讨论】:
标签: asp.net-core azure-active-directory microsoft-graph-api