【发布时间】:2021-11-06 09:23:52
【问题描述】:
我正在使用 Microsoft Graph 登录端点:login.microsoftonline.com/[tenantId]/oauth2/token,授予类型为“密码”的用户登录:
{
"grant_type": "password",
"client_id": "xxx",
"client_secret": "xxx",
"scope": "openid",
"resource": "https://graph.microsoft.com",
"username": "username",
"password": "********",
}
当我向未在我们的 AD 上注册多因素身份验证的用户发布此内容时,我得到了预期的结果,包括 access_token 和 refresh_token
但是,对于已注册的用户,我会返回一个 HttpStatusCode.BadRequest,错误为 "interaction_required"
根据微软的文档发现here:
在这种情况下,您的应用会收到一个 400 和一个interaction_required 获取访问令牌期间出错或出现 403 调用 Microsoft Graph 时出现不足的声明错误。在这两种情况下, 错误响应包含附加信息,可以 提交给授权端点以质询用户 附加信息(如多重身份验证或设备 注册)。
但是,我在结果中看不到任何其他信息,也找不到有关后续步骤的更多信息。我得到的 JSON 是这样的:
{
"error":"interaction_required",
"error_description":"AADSTS50079: Due to a configuration change made by your administrator, or because you moved to a new location, you must enroll in multi-factor authentication to access '00000003-0000-0000-c000-000000000000'.\r\nTrace ID: aee10c85-fd12-42ec-be6c-76d546500100\r\nCorrelation ID: 0ee3ebac-f702-4fbc-be76-fd6a291ad488\r\nTimestamp: 2021-09-09 17:45:24Z",
"error_codes":[50079],"timestamp":"2021-09-09 17:45:24Z",
"trace_id":"aee10c85-fd12-42ec-be6c-76d546500100",
"correlation_id":"0ee3ebac-f702-4fbc-be76-fd6a291ad488",
"error_uri":"https://login.microsoftonline.com/error?code=50079",
"suberror":"basic_action"
}
但我正在回复“interaction_required”,并与我们的 AD 管理员确认他们肯定已注册。所以我对解决这个问题的后续步骤有点茫然。
【问题讨论】:
标签: authentication active-directory azure-active-directory