oauth-2.0 - 带有端点版本的 Azure AD OAuth 2 2 - 工作帐户成功,个人帐户失败,错误代码 "Microsoft account is experiencing technical problems."

标签 oauth-2.0 azure-active-directory

我们正在向我们的网站添加 Microsoft 登录功能。我们的要求是支持来自 Azure Active Directory 的个人 Microsoft 帐户和工作/学校帐户。

我只能在这篇文章中发布 2 个网址,因此我会用空格将它们分开。

我们仔细遵循以下 URL 中的 Microsoft 文档:https://azure.microsoft.com/en-us/documentation/articles/active-directory-v2-protocols/

  • 我们的应用已在 apps.dev.microsoft.com 中注册

  • 我们使用的端点是:

https://login.microsoftonline.com/common/oauth2/v2.0/authorize

https://login.microsoftonline.com/common/oauth2/v2.0/token

学校/工作帐户成功

当我们使用此协议(protocol)启动 OAuth 2 登录时,我们将进入 Microsoft 的登录页面,网址为:https://login.microsoftonline.com/common/oauth2/v2.0/authorize

以“[email protected] ”的形式输入具有学校/工作帐户的用户的电子邮件地址和密码,可以成功验证该用户的身份,我们收到访问 token ,并且能够成功查询 Microsoft Graph API。

个人帐户失败

当我们启动 OAuth 2 登录并转到 https://login.microsoftonline.com/common/oauth2/v2.0/authorize 但输入个人 Microsoft 帐户电子邮件地址时,我们会立即重定向到 Microsoft 个人帐户帐户登录页面位于以下 URL:

https://login.microsoftonline.com/common/oauth2/v2.0/authorize?response_type=code&client_id=00000000-0000-0000-0000-000000000000&redirect_uri=https%3A%2F%2Fsub.example.com%2Flogin %2Foffice365%2Fprocess&scope=openid%20User.Read&response_mode=query&state=0000000000qi7ua80000000000

失败并重定向到错误页面并显示以下消息:

“Microsoft 帐户遇到技术问题。请稍后重试。”

错误页面的URL是:

https://login.live.com/err.srf?lc=1033#error=invalid_request&error_description=The+provided+value+for+the+input+parameter+'redirect_uri'+is+not+valid.+The +预期+值+是+'https://login.live.com/oauth20_desktop.srf'+或+a+URL+which+matches+the+redirect+URI+registered+for+this+client+application。&state= 0000000000qi7ua80000000000

我们的调试步骤

  • 尝试添加/删除重定向 URL 的多种组合和排序,包括带子域和不带子域、仅包含不带路径的域等等(https://example.com、https://sub. example.com)

  • 尝试将错误消息中提到的网址 (https://login.live.com/oauth20_desktop.srf) 添加到我们允许的重定向网址

  • 启用 Chrome 调试器并记录网络请求,以确认我们的重定向 URL 与传递给 Microsoft 登录的参数以及在我们的应用中注册的内容相匹配

最佳答案

看起来你做的一切都是正确的。在过去的几周里,apps.dev.microsoft.com 门户有时无法在 Microsoft 帐户数据存储中记录 redirect_uri。看来您遇到了这个错误。

目前唯一的解决方法是尝试删除并重新添加 apps.dev.microsoft.com 中的 redirect_uri,直到它真正粘住为止。对于其他人来说,通过创建新的应用程序 ID 重新开始效果很好。

关于oauth-2.0 - 带有端点版本的 Azure AD OAuth 2 2 - 工作帐户成功,个人帐户失败,错误代码 "Microsoft account is experiencing technical problems.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39750197/

相关文章:

python - Stocktwits API - 从脚本获取访问 token ,无需用户交互

session - OAuth 2.0。没有 session ? (无国籍)

azure - 如何修复 - 重新登录时,CORS 策略已阻止对 'https://login.windows.net......' 处的 fetch 进行访问

azure-active-directory - MSGraph token 错误: "Application (...) was not found in the directory"

azure - 是否需要通过 https ://apps. dev.microsoft.com 注册新应用程序?

oauth-2.0 - 使用 oauth Google Drive 访问之前创建的文件夹

c# - 调用 IdentityServer4 生成 System.NullReferenceException : Object reference not set to an instance of an object

azure - Azure Web API 的身份验证 token

Azure Web 应用程序从 AAD 身份验证注销

oauth-2.0 - 有没有办法从 Identity Server 中的客户端更新 IDP session token