# 检查其他网站上用户是否已登录 Discourse

**URL:** <https://meta.discourse.org/t/checking-whether-a-user-is-logged-in-on-discourse-from-another-website/291185>\
**Category:** SSO\
**Created:** [2024 年1 月 10 日 15:21 UTC](https://meta.discourse.org/t/checking-whether-a-user-is-logged-in-on-discourse-from-another-website/291185 "2024-01-10T15:21:30Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

作者： ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
发布日期： [2024 年7 月 3 日 21:28 UTC](https://meta.discourse.org/t/checking-whether-a-user-is-logged-in-on-discourse-from-another-website/291185/5 "2024-07-03T21:28:13Z")

</div>

我不知道使用 Discourse 作为身份验证提供商是否因为它的名字（[DiscourseConnect](https://meta.discourse.org/t/13045?silent=true)）而被忽视了。例如，仅仅在这里的帖子中添加术语 `DiscourseConnect` 就会创建一个指向关于使用外部网站作为 Discourse 身份验证提供商的帖子的链接。将 _Discourse_ 用作身份验证提供商是我拥有 Discourse 站点的几个主要理由之一。

如果这有帮助的话，WordPress 插件允许 Discourse 充当身份验证提供商。相关代码在这里：[https://github.com/discourse/wp-discourse/tree/main/lib/sso-client。代码可能有些过于复杂。](https://github.com/discourse/wp-discourse/tree/main/lib/sso-client%E3%80%82%E4%BB%A3%E7%A0%81%E5%8F%AF%E8%83%BD%E6%9C%89%E4%BA%9B%E8%BF%87%E4%BA%8E%E5%A4%8D%E6%9D%82%E3%80%82)

这是一个更直接的 Remix/React 应用程序实现：[https://github.com/scossar/discourse\_remix\_comments/blob/main/app/routes/login.tsx。如果你忽略](https://github.com/scossar/discourse_remix_comments/blob/main/app/routes/login.tsx%E3%80%82%E5%A6%82%E6%9E%9C%E4%BD%A0%E5%BF%BD%E7%95%A5) TypeScript 的内容，那并不复杂。

---

_[View the full topic](https://meta.discourse.org/t/checking-whether-a-user-is-logged-in-on-discourse-from-another-website/291185)._
