# 如何在 Discourse 中设置 Okta 认证

**URL:** https://meta.discourse.org/t/how-to-setup-okta-authentication-with-discourse/134534
**Category:** Self-hosting
**Created:** [2019年十一月27日 12:07 UTC](https://meta.discourse.org/t/how-to-setup-okta-authentication-with-discourse/134534 "2019-11-27T12:07:45Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![annakulaachyuth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/annakulaachyuth/32/162347_2.png) [@annakulaachyuth](https://meta.discourse.org/u/annakulaachyuth)
#### Post date: [2019年十一月27日 12:07 UTC](https://meta.discourse.org/t/how-to-setup-okta-authentication-with-discourse/134534/1 "2019-11-27T12:07:45Z")

</div>

我们使用 Okta 作为应用程序的身份提供商。我们能否让用户通过 Okta 使用相同的凭据登录我们的 Discourse 社区？此外，如果用户已登录我们的应用程序，他们是否可以实现自动登录？

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2019年十一月27日 12:35 UTC](https://meta.discourse.org/t/how-to-setup-okta-authentication-with-discourse/134534/2 "2019-11-27T12:35:13Z")

</div>

您应该能够使用 openid-connect 插件配置 Okta 集成

> [@Discourse OpenID Connect (OIDC)](https://meta.discourse.org/t/openid-connect-authentication-plugin/103632?u=david):
>
> discourse2Summary Discourse OpenID Connect allows an OpenID Connect provider to be used as an authentication provider for Discourse.open_bookInstall Guide This plugin is bundled with Discourse core. There is no need to install the plugin separately. Features The plugin aims to provide a minimal implementation of [the specification](https://openid.net/specs/openid-connect-basic-1_0.html). Specifically, it supports the “Authorization Code Flow”. To get started, follow [the plugin installation instructions](https://meta.discourse.org/t/install-plugins-in-discourse/19157), or contact your hosti…

---

<div class="post-metadata">

### Author: ![annakulaachyuth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/annakulaachyuth/32/162347_2.png) [@annakulaachyuth](https://meta.discourse.org/u/annakulaachyuth)
#### Post date: [2019年十一月27日 15:37 UTC](https://meta.discourse.org/t/how-to-setup-okta-authentication-with-discourse/134534/3 "2019-11-27T15:37:57Z")

</div>

那自动登录呢？……我的意思是，当用户登录我的应用时，他们需要在 Discourse 中自动登录或注册（无需再次进行身份验证）。

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2019年十一月27日 15:41 UTC](https://meta.discourse.org/t/how-to-setup-okta-authentication-with-discourse/134534/4 "2019-11-27T15:41:04Z")

</div>

如果您的 Discourse 站点设置为 `login_required`，则会立即触发与 Okta 的身份验证。如果用户在 Okta 上拥有活跃会话，则无需任何交互即可登录。

如果您的 Discourse 未设置为 `login_required`，则用户只需点击/轻触“登录”一次即可。

---

<div class="post-metadata">

### Author: ![annakulaachyuth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/annakulaachyuth/32/162347_2.png) [@annakulaachyuth](https://meta.discourse.org/u/annakulaachyuth)
#### Post date: [2019年十一月27日 16:08 UTC](https://meta.discourse.org/t/how-to-setup-okta-authentication-with-discourse/134534/5 "2019-11-27T16:08:26Z")

</div>

那么，如果我们设置 `login_required`，是否意味着如果用户未登录我的应用，就会强制要求其登录？  
如果是这样，未登录的用户将无法查看任何社区帖子！！！  
但我们希望用户即使不登录我的应用，也能查看帖子（只读）。

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2019年十一月27日 16:31 UTC](https://meta.discourse.org/t/how-to-setup-okta-authentication-with-discourse/134534/6 "2019-11-27T16:31:38Z")

</div>

[quote=“annakulaachyuth, 帖子：5, 主题：134534”]  
我们也希望用户在不登录我的应用的情况下也能查看帖子（只读）。[/quote]

那么你需要保持 `login_required` 禁用，用户将需要点击按钮进行登录。你可以在你的应用中尝试一些技巧来自动触发登录，但 Discourse 本身并没有提供这样的功能。

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2019年十二月27日 16:35 UTC](https://meta.discourse.org/t/how-to-setup-okta-authentication-with-discourse/134534/7 "2019-12-27T16:35:27Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
