# SSO集成问题 - 需要关于自动认证的帮助

**URL:** https://meta.discourse.org/t/sso-integration-issue-need-help-with-automatic-authentication/357947
**Category:** WordPress
**Created:** [2025年三月19日 12:55 UTC](https://meta.discourse.org/t/sso-integration-issue-need-help-with-automatic-authentication/357947 "2025-03-19T12:55:34Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![omriz](https://avatars.discourse-cdn.com/v4/letter/o/df788c/32.png) [@omriz](https://meta.discourse.org/u/omriz)
#### Post date: [2025年三月19日 12:55 UTC](https://meta.discourse.org/t/sso-integration-issue-need-help-with-automatic-authentication/357947/1 "2025-03-19T12:55:34Z")

</div>

您好，社区成员们：

我正在寻求有关单点登录（SSO）集成挑战的帮助。我们已成功在开发者中心和社区平台之间实现了SSO，但目前遇到一个特定问题：

目前，即使在用户已登录我们的开发者中心（我们的SSO提供商）的情况下，他们在访问社区平台时仍需要经历一个明确的身份验证流程。这需要用户重定向到开发者中心，然后再返回社区。

我们的目标是提供一种无缝的体验，让已在开发者中心通过身份验证的用户可以直接导航到社区并自动登录，无需额外的重定向。

我们已经实现了BBpress，并且基本的登录功能可以正常工作，但这种自动身份验证功能并未按预期工作。

是否有人成功实现了这种无缝SSO流程？任何代码示例、配置建议或文档都将不胜感激。

谢谢！

Omri Azim  
应用程序工程师 - 社区经理  
Hailo

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [2025年三月19日 13:05 UTC](https://meta.discourse.org/t/sso-integration-issue-need-help-with-automatic-authentication/357947/3 "2025-03-19T13:05:21Z")

</div>

你好 Hailo，

你描述的正是 [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) 的预期工作方式。

在 Discourse 端，有一个名为 `auth immediately` 的站点设置，顾名思义，该设置会立即启动身份验证流程。但是，正如该设置的描述所指出的那样：

> 自动重定向到外部登录系统，无需用户交互。这仅在 `login_required` 为 true 且只有一个外部身份验证方法时生效。

假设你的站点未设置为 `login required`，你可以直接从 WordPress 链接到 [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) 身份验证端点，而不是链接到 Discourse 的基础域。更多信息请参阅：

> [@Automatic account creation and login when login\_required is false](https://meta.discourse.org/t/automatic-account-creation-and-login-when-login-required-is-false/352796/2?u=angus):
>
> You can achieve that by linking to https://community.example.com/session/sso for authenticated users in your application. That will trigger the login / account creation flow. You could also add the parameter ?return\_path to link to a specific page. For unauthenticated users you should still link to https://community.example.com.
