# Discourse 向けの Slack ログイン/SSO を探しています

**URL:** https://meta.discourse.org/t/seeking-slack-login-sso-for-discourse/145461
**Category:** SSO
**Created:** [2020 年 3 月 24 日午後 9:30 UTC](https://meta.discourse.org/t/seeking-slack-login-sso-for-discourse/145461 "2020-03-24T21:30:50Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![sunjam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sunjam/32/175682_2.png) [@sunjam](https://meta.discourse.org/u/sunjam)
#### Post date: [2020 年 3 月 24 日午後 9:30 UTC](https://meta.discourse.org/t/seeking-slack-login-sso-for-discourse/145461/1 "2020-03-24T21:30:50Z")

</div>

**Discourse で SSO オプションとして Slack を追加することは可能でしょうか？** これについて古いスレッド（以下にリンク）を見たのですが、削除されたか非公開になったようです。 ご助言いただければ幸いです。 chat-integration は存在することは知っているのですが、Slack ユーザーが自身のアカウントでログインできるようにしたいと考えています。 よろしくお願いします。

> [@\[Paid\] WP + Discourse user authentication for IRC or other chat](https://meta.discourse.org/t/paid-wp-discourse-user-authentication-for-irc-or-other-chat/61439/4?u=sunjam):
>
> Bear in mind we already have a Slack Login plugin: [https://meta.discourse.org/t/slack-login-plugin/29142](https://meta.discourse.org/t/slack-login-plugin/29142) And [Discord also supports OAuth2](https://discordapp.com/developers/docs/topics/oauth2), so making a plugin for it should be doable with your budget.

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [2020 年 3 月 25 日午前 12:20 UTC](https://meta.discourse.org/t/seeking-slack-login-sso-for-discourse/145461/2 "2020-03-25T00:20:48Z")

</div>

Slack は SSO 向けに SAML を提供していますが、これは Plus プランまたはエンタープライズプランの顧客に限定されています。

> **[Set up SAML single sign-on for Slack](https://slack.com/help/articles/203772216-Set-up-SAML-single-sign-on-for-Slack)**
>
> SAML-based single sign-on (SSO) gives members access to Slack through an identity provider (IDP) of your choice.Note: If you're having trouble setting up SAML SSO, visit Troubleshoot SAML authoriza...

あなたはこれらのティアのいずれかに該当しますか？

公式の SAML プラグインは既に存在します。こちらをご覧ください：

> **[GitHub - discourse/discourse-saml: Support for SAML in Discourse](https://github.com/discourse/discourse-saml/)**
>
> Support for SAML in Discourse

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2020 年 3 月 27 日午前 4:43 UTC](https://meta.discourse.org/t/seeking-slack-login-sso-for-discourse/145461/3 "2020-03-27T04:43:58Z")

</div>

> [@Stephen](#):
>
> Slack は SSO 向けに SAML を提供していますが、Plus プランまたはエンタープライズプランの顧客に限られます。

その記事は、Slack を SSO クライアントとして使用する方法についてです。  
OAuth2 を使用する「Slack でサインイン」という機能もあります：[Slack developer docs | Slack Developer Docs](https://api.slack.com/docs/sign-in-with-slack%EF%BC%88%E3%81%9F%E3%81%A0%E3%81%97%E3%80%81%E7%A7%81%E3%81%AF%E8%A9%A6%E3%81%97%E3%81%9F%E3%81%93%E3%81%A8%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%9B%E3%82%93%EF%BC%89%E3%80%82)

---

<div class="post-metadata">

### Author: ![sunjam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sunjam/32/175682_2.png) [@sunjam](https://meta.discourse.org/u/sunjam)
#### Post date: [2020 年 4 月 22 日午後 9:39 UTC](https://meta.discourse.org/t/seeking-slack-login-sso-for-discourse/145461/4 "2020-04-22T21:39:25Z")

</div>

私の目的は、 ![Screen Shot 2020-04-22 at 2.56.25 PM](https://global.discourse-cdn.com/meta/original/3X/5/4/54f98305678a812087567fe5a461a8b8846f8907.png) を追加することです。

[サインイン](https://api.slack.com/docs/sign-in-with-slack) のドキュメントは、Discourse に追加する素晴らしい新機能として完璧です。チャット統合も有効化しており、これも素晴らしいです。Discourse の tests-pass を使用して、このボタンをカスタムオプションとして追加する方法については、少し理解が追いついていません。この方法が分かれば、このソーシャルログインは、GitHub や Patreon などの同様のソーシャルログインと相性が良いでしょう。

ドキュメントに従って、Slack で OAuth アクセスを持つアプリを作成しました…現在は、[ボタン作成のこのステップ](https://api.slack.com/docs/sign-in-with-slack#generator) にあります。

### Slack で表示されている情報:

App ID  
Client ID  
Signing Secret  
Client Secret  
Verification Token  
Oauth Access Token  
`redirect url` を `https://example.domain.com/slack/auth` として追加

### Discourse で表示されているオプション:

`enable sso provider`  
`sso url` – 単一サインオンエンドポイントの URL（http:// または https:// を含む必要があります）  
`sso secret` – SSO 情報を暗号学的に認証するために使用される秘密文字列（10 文字以上であることを確認してください）

このドキュメントを使用して設定を試みています:

> [@Setup DiscourseConnect - Official Single-Sign-On for Discourse (sso)](https://meta.discourse.org/t/official-single-sign-on-for-discourse-sso/13045):
>
> [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) is a core Discourse feature that allows you to configure “Single Sign-On (SSO)” to completely outsource all user registration and login from Discourse to another site. Offered to our [pro, business and enterprise hosting customers](https://discourse.org/pricing). information_source (Feb 2021) ‘[Discourse SSO](https://meta.discourse.org/t/13045?silent=true)’ is now ‘[DiscourseConnect](https://meta.discourse.org/t/13045?silent=true)’. If you are running an old version of Discourse, the settings below will be named sso\_... rather than discourse\_connect\_... The Problem Many sites wishing to integrate wit…

Slack は以下をサポートしています:  
[identity.avatar](https://api.slack.com/scopes/identity.avatar) - ユーザーの Slack アバターを表示  
[identity.basic](https://api.slack.com/scopes/identity.basic) - ユーザーのアイデンティティに関する情報を表示  
[identity.email](https://api.slack.com/scopes/identity.email) - ユーザーのメールアドレスを表示  
[identity.team](https://api.slack.com/scopes/identity.team) - ユーザーの Slack ワークスペース名を表示

Slack ユーザーのアバター、できればワークスペース名も表示できると良いですね。また、Discourse を使用する際に極めて重要であるため、メールアドレスへのアクセスも有用だと思われます。

---

<div class="post-metadata">

### Author: ![sunjam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sunjam/32/175682_2.png) [@sunjam](https://meta.discourse.org/u/sunjam)
#### Post date: [2020 年 4 月 22 日午後 10:19 UTC](https://meta.discourse.org/t/seeking-slack-login-sso-for-discourse/145461/5 "2020-04-22T22:19:54Z")

</div>

なるほど、そのガイドで SSO を有効にすると、他のログイン/登録設定が完全に上書きされてしまうようです。

私は以下の設定で Slack の SSO を動作させることができました：  
sso url = `https://slack.com/oauth/v2/authorize?user_scope=identity.basic&client_id=EXAMPLE`  
sso secret = Client Secret

しかし、単にボタンとして追加したいだけです。Discourse へのこのボタンの実装方法について、ご提案いただければ幸いです：[実装方法](https://api.slack.com/docs/sign-in-with-slack#generator) 👍  
 ![Screen Shot 2020-04-22 at 2.56.25 PM](https://global.discourse-cdn.com/meta/original/3X/5/4/54f98305678a812087567fe5a461a8b8846f8907.png)

現在は、以下のページを参考に、OAuth2 Basic プラグイン経由でボタンを追加する方法を検討しています：

> [@Configure sign up and log in with Auth0 using the OAuth2 Basic Plugin](https://meta.discourse.org/t/how-to-use-auth0-with-the-oauth2-basic-plugin/64633):
>
> If you are using [Auth0](https://auth0.com/) as your identity provider this guide will show you how to setup authentication using the [Discourse OAuth2 Basic Plugin](https://meta.discourse.org/t/oauth2-basic-support/33879). Initial Steps Create an Auth0 account if you don’t already have one The [Discourse OAuth2 Basic Plugin](https://meta.discourse.org/t/oauth2-basic-support/33879) ships pre-installed with Discourse. If you are self-hosted, ensure the plugin is enabled. For [hosted plans](https://www.discourse.org/pricing), the plugin is available on Business tier and above. Configure Auth0 Applications → Create Application Give your client a name like “Discourse…

---

<div class="post-metadata">

### Author: ![weallwegot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/weallwegot/32/124753_2.png) [@weallwegot](https://meta.discourse.org/u/weallwegot)
#### Post date: [2021 年 3 月 11 日午後 5:18 UTC](https://meta.discourse.org/t/seeking-slack-login-sso-for-discourse/145461/6 "2021-03-11T17:18:32Z")

</div>

こんにちは、私も追跡して調べているのですが、Discourse での対応状況について何か更新はありますか？

---

<div class="post-metadata">

### Author: ![sunjam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sunjam/32/175682_2.png) [@sunjam](https://meta.discourse.org/u/sunjam)
#### Post date: [2021 年 3 月 11 日午後 6:43 UTC](https://meta.discourse.org/t/seeking-slack-login-sso-for-discourse/145461/7 "2021-03-11T18:43:01Z")

</div>

すべての要素は揃っていますが、当時はうまくいかず、手探りでした。時間が経った今、ぜひ試してみてください！管理者として Slack の OAuth パネルを使い、Discourse に追加してみましょう。
