Discourse 作为 SSO 提供商和社交登录时出现问题

你好,

问题

通过 API(域名 A)将 Discourse 用作 SSO 提供商时,如果您尝试通过社交按钮在 Discourse(域名 B)上注册,您不会立即看到 create-account 模态框,而是会返回到 login 模态框。

此时,您需要关闭 login 模态框,然后点击 Sign Up 按钮,才能看到本应首先显示的 create-account 模态框。

问题演示

以下是简短的视频演示:

  • 使用 Edge 浏览器,已清理缓存/Cookie,且未安装任何扩展。
  • 使用配置为将 Discourse 作为 SSO 提供商的 WP-Discourse(这是展示该问题的最快方式)。

首先看到的是我点击 WP-Discourse SSO 登录链接。
点击 Facebook 按钮后,我被重定向到登录 modal,而不是 create-account

可能的原因

我们使用了不同的域名来部署 Discourse 以及调用 API 的服务器。

为了确保问题并非来自插件或其他因素,我已在干净的 WordPress(配置了 WP-Discourse 以使用 Discourse 作为 SSO 提供商)和干净的 Discourse 上复现了该问题。两者均位于不同的域名上。

注意:这与 wp-discourse 无关,这只是为了更方便地展示/测试该问题。我们也可以使用我们的应用复现此问题,该应用同样调用 Discourse API 并将其作为 SSO 提供商。)

其他信息

  • Discourse 安全设置已禁用(不确定是否有影响,CSP 已禁用,Cookie 策略设置为 None 或 Disabled)。
  • Discourse 已更新至最新版本。
  • 使用 SSO 登录没有问题。
  • 浏览器控制台或 Discourse 日志中无任何错误信息。
  • 如果您通过 SSO API 遇到此问题,然后尝试直接在 Discourse 上进行社交注册,也会出现同样的问题。此时,您需要清除 Cookie/缓存才能使其正常工作。(此处有类似报告:https://meta.discourse.org/t/suggestion-unite-the-sign-up-log-in-buttons/160085)

既然 Discourse 在您手动点击 Sign Up 后能够显示带有预填字段的预期 create-modal,这让我认为存在一个 Bug 或 Discourse 本应能处理的情况,我理解错了吗?

有什么方法可以修复此行为吗?我们是否遗漏了某些配置?

谢谢!

5 个赞

Is this bug that unimportant to be ignored again?

I reported a similar issue in January but here you can see a minimalist reproduction with nothing else with vanilla discourse and an official SSO implementation. If anything, I would like someone to either acknowledge there is a bug or saying what we’re doing is wrong.

How do we get attention to this issue? Is it possible to hire team members if money is an issue?

– A frustrated client & dev.

1 个赞

Hi, I’ve set up wp-discourse on a default Wordpress installation, set WP as SSO client and configured Facebook login on Discourse. Both websites are hosted on different domains.

I’ll let both websites public for a few days/weeks so anyone with a Facebook account can test and see the issue by themselves.

edit : deleted my dev discourse, but that was doing the same exact thing as in arkshine’s video anyway.

Click “login with Facebook” and see the same popup show up again instead of showing the “Create New Account” popup with pre-filled fields.

3 个赞