Azure AD B2C 的 Twitter 社交登录问题 - 禁止

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

我正在尝试为 Azure AD B2C 租户添加 Twitter 社交登录。我遵循了 Microsoft 的以下说明 https://learn.microsoft.com/en-us/azure/active-directory-b2c/identity-provider-twitter?pivots=b2c-user-flow

当我尝试测试用户流程时,出现如下错误。

从“https://api.twitter.com/oauth/request_token”获取令牌的请求返回错误“Forbidden”

我重新创建了 Twitter 凭据只是为了确保这个问题不是因为凭据。我几乎检查了一切,但问题仍然存在。

此外,我无法通过 Azure AD 共享的相关 ID 找到有关上述错误的更多详细信息。我已经检查了 Azure B2C 中可用的所有日志,但找不到任何关于此错误的痕迹。

我使用相同的 Twitter 凭据创建了一个 .net 示例,并且社交登录没有任何问题。

所以这个问题似乎专门与 Azure B2C 有关。任何解决这个问题的建议都将不胜感激。

谢谢

twitter azure-active-directory azure-ad-b2c
1个回答
0
投票

我尝试在我的环境中重现相同的内容并得到以下结果:

我有一个名为

B2C_1_SUSI
的用户流,我在其中添加了 Twitter 作为身份提供者,然后像这样运行它:

enter image description here

我得到登录屏幕,包括在选择Run user flow

后使用您的社交帐户登录
,如下所示:

enter image description here

当我点击

Twitter
时,我得到了和你一样的错误

enter image description here

如果添加有问题,通常会出现错误

Callback URI / Redirect URLs
User Authentication settings page.

如本MS文档中所述

在输入租户名称和用户流名称时,您需要使用所有小写字母,即使它们在 Azure AD B2C 中是用大写字母定义的。

当我在 Twitter Developer Portal 的User Authentication settings 应用程序页面中检查相同内容时,用户流名称是大写的,如下所示:

https://sritestb2caad.b2clogin.com/sritestb2caad.onmicrosoft.com/B2C_1_SUSI/oauth1/authresp

enter image description here

为了解决错误,我将用户流名称更改为小写,如文档中所述:

https://sritestb2caad.b2clogin.com/sritestb2caad.onmicrosoft.com/b2c_1_susi/oauth1/authresp

enter image description here

保存后,我再次运行 userflow,在屏幕下方 授权这样的应用程序:

enter image description here

当我点击

Authorize app

按钮时,它成功地将我重定向到User Details页面,如下所示:

enter image description here

在您的情况下,通过单击旁边的

Callback URI / Redirect URLs

按钮,检查您是否以正确的格式添加了Edit
User Authentication settings
页面,如下所示:

enter image description here

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