# שימוש ב-Discourse כספק זהות (SSO, DiscourseConnect)

**URL:** https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974
**Category:** Integrations
**Tags:** sso, discourseconnect, how-to
**Created:** [7 בספטמבר,‏ 2015,‏ 9:19am UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974 "2015-09-07T09:19:21Z")
**Posts on this page:** 20
**Page:** 5

<div class="post-metadata">

### Author: ![j127](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j127/32/79093_2.png) [@j127](https://meta.discourse.org/u/j127)
#### Post date: [23 בינואר,‏ 2019,‏ 7:18pm UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/82 "2019-01-23T19:18:29Z")

</div>

> [@techAPJ](#):
>
> Ruby:  
> [GitHub - gogo52cn/sso\_with\_discourse: Implementation in ruby for https://meta.discourse.org/t/using-discourse-as-a-sso-provider/32974](https://github.com/gogo52cn/sso_with_discourse)

Does anyone know if this Ruby/Rails integration moved to a new location? Or if it was removed, does anyone have a copy of the old code?

(It looks like the Go repo is also gone.)

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [23 בינואר,‏ 2019,‏ 8:02pm UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/83 "2019-01-23T20:02:35Z")

</div>

> [@j127](#):
>
> Does anyone know if this Ruby/Rails integration moved to a new location?

It’s very possible @gogo52cn is the same person as [gogo52cn · GitHub](https://github.com/gogo52cn) ; they might be able to let us know?

---

<div class="post-metadata">

### Author: ![allu](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@allu](https://meta.discourse.org/u/allu)
#### Post date: [23 בינואר,‏ 2019,‏ 8:05pm UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/84 "2019-01-23T20:05:46Z")

</div>

Is it possible to use discourse as a LDAP provider?

---

<div class="post-metadata">

### Author: ![j127](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j127/32/79093_2.png) [@j127](https://meta.discourse.org/u/j127)
#### Post date: [24 בינואר,‏ 2019,‏ 10:24pm UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/85 "2019-01-24T22:24:32Z")

</div>

I don’t know if I’m doing it correctly, but [this initial sketch](https://gist.github.com/j127/e30efaad84a4c5137c3c6bed500b5dd3) for Rails 5.2 seems to work (in case it can save time for anyone). If anyone has suggestions for improving it, let me know.

I also saw an [OmniAuth strategy](https://github.com/lackstein/omniauth-discourse), but I haven’t looked closely at it yet.

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [24 בינואר,‏ 2019,‏ 10:43pm UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/86 "2019-01-24T22:43:34Z")

</div>

No, this not possible.

---

<div class="post-metadata">

### Author: ![jucajuca](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@jucajuca](https://meta.discourse.org/u/jucajuca)
#### Post date: [10 ביוני,‏ 2019,‏ 8:51am UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/87 "2019-06-10T08:51:14Z")

</div>

hello, I installed the plugin in WP-multisite.  
I network-activated the plugin. The plugin showed that the connection was sucessful

I configured the credentials in one of the sites to enable Discourse as SSO provider.

However when I click on “Log in with Discourse” I get a 500 Error. Lookin at the logs I found this:

` "talk.co-pp.io" 172.17.0.1 "GET /session/sso_provider?sso=bm9uY2U9YTk2ZWZkYzRjMmIyZmJlM2FjNTAzYTYzOWRiYzBkZTQmcmV0dXJuX3Nzb191cmw9aHR0cCUzQSUyRiUyRmNvLXBwLmlv&sig=33b1edba92b8f0d93b0e57edaf262e73a20689aeff2d86e2f61012d9cd99e878 HTTP/1.1" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36" "-" 500 906 "-" 0.016 0.018 "-"`

Any ideas?

---

<div class="post-metadata">

### Author: ![AstonJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/astonj/32/215041_2.png) [@AstonJ](https://meta.discourse.org/u/AstonJ)
#### Post date: [19 בדצמבר,‏ 2019,‏ 9:11pm UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/91 "2019-12-19T21:11:24Z")

</div>

@j127 @supermathie - there is a copy here…

[https://github.com/AstonJ/sso\_with\_discourse](https://github.com/AstonJ/sso_with_discourse)

---

<div class="post-metadata">

### Author: ![j127](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j127/32/79093_2.png) [@j127](https://meta.discourse.org/u/j127)
#### Post date: [19 בדצמבר,‏ 2019,‏ 9:56pm UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/92 "2019-12-19T21:56:37Z")

</div>

Thanks – I recently switched to Phoenix and rewrote the SSO code in Elixir. (Your forum is great, by the way.)

---

<div class="post-metadata">

### Author: ![AstonJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/astonj/32/215041_2.png) [@AstonJ](https://meta.discourse.org/u/AstonJ)
#### Post date: [19 בדצמבר,‏ 2019,‏ 10:01pm UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/93 "2019-12-19T22:01:10Z")

</div>

Ah that’s awesome Josh! Could you add it to the first post of this thread please? Hopefully I will get a chance to use it soon 😃

_Also thank you for the kind words! If you like that forum, I am hoping to launch another (Discourse) forum next year which you might like as well 😊_

---

<div class="post-metadata">

### Author: ![j127](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j127/32/79093_2.png) [@j127](https://meta.discourse.org/u/j127)
#### Post date: [19 בדצמבר,‏ 2019,‏ 11:47pm UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/94 "2019-12-19T23:47:39Z")

</div>

> [@AstonJ](#):
>
> Ah that’s awesome Josh! Could you add it to the first post of this thread please? Hopefully I will get a chance to use it soon

Sure, I’ll have to extract it from the Phoenix app, but then I’ll post it on Github. Maybe other people can help improve it, since this is my first real Phoenix site.

> [@AstonJ](#):
>
> If you like that forum, I am hoping to launch another (Discourse) forum next year which you might like as well

Looking forward to seeing it. I read your other forum regularly.

---

<div class="post-metadata">

### Author: ![Michael\_Ball](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michael_ball/32/121542_2.png) [@Michael\_Ball](https://meta.discourse.org/u/Michael_Ball)
#### Post date: [20 בדצמבר,‏ 2019,‏ 8:32pm UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/95 "2019-12-20T20:32:39Z")

</div>

Can I use Discourse as an SSO provider if I’m also using SSO as my discourse auth?  
I have things setup, but it doesn’t seem like Discourse correctly calls back the return URL.

…and yes, I do realize that Discourse is just acting as an SSO proxy, but the primary web app only implements [Discourse SSO](https://meta.discourse.org/t/13045?silent=true). This is not meant to be a permanent strategy but a temporary one, or at least a useful tool to have.

---

<div class="post-metadata">

### Author: ![Thottempudi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thottempudi/32/166138_2.png) [@Thottempudi](https://meta.discourse.org/u/Thottempudi)
#### Post date: [29 בינואר,‏ 2020,‏ 5:45am UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/96 "2020-01-29T05:45:44Z")

</div>

Hi,  
I am using [ASP.NET](http://ASP.NET) Core and receiving the below error.

> SSO authentication failed due to missing secret. Contact the site administrators to fix this problem.

Please let me know any code changes or setting changes required for this issue?

---

<div class="post-metadata">

### Author: ![X\_Code](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/x_code/32/148529_2.png) [@X\_Code](https://meta.discourse.org/u/X_Code)
#### Post date: [1 בפברואר,‏ 2020,‏ 7:57am UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/97 "2020-02-01T07:57:56Z")

</div>

I got the same issue.

[https://review.discourse.org/t/fix-better-error-when-sso-fails-due-to-blank-secret-7946/4894](https://review.discourse.org/t/fix-better-error-when-sso-fails-due-to-blank-secret-7946/4894)

It seems to indicate “blank secret”.

 ![image](https://global.discourse-cdn.com/meta/original/3X/6/0/6031088ea6ffbf4293d5947dd730cda4795ccf11.png)

Maybe it is the domain not matching?

---

<div class="post-metadata">

### Author: ![X\_Code](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/x_code/32/148529_2.png) [@X\_Code](https://meta.discourse.org/u/X_Code)
#### Post date: [1 בפברואר,‏ 2020,‏ 8:11am UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/98 "2020-02-01T08:11:23Z")

</div>

This seems to be a bug in Discourse

> <https://github.com/discourse/discourse/blob/1014e56e804049bcfb0b38029408f73313ec6290/app/controllers/session_controller.rb#L46>

> <https://github.com/discourse/discourse/blob/1014e56e804049bcfb0b38029408f73313ec6290/lib/single_sign_on_provider.rb#L8>

sso\_secret is nil for sure 😂

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [18 במרץ,‏ 2020,‏ 11:05pm UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/99 "2020-03-18T23:05:32Z")

</div>

Scroll down to line 25 - it parses the host out of the `return_url` and looks up the secret using that.

---

<div class="post-metadata">

### Author: ![balupton](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/balupton/32/255461_2.png) [@balupton](https://meta.discourse.org/u/balupton)
#### Post date: [28 באפריל,‏ 2020,‏ 12:39pm UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/100 "2020-04-28T12:39:33Z")

</div>

Is it possible to get an API key from the SSO flow such that my app can create posts from the sso authed discourse user?

Or is the recommended way to create an `all users` api key, then when creating a post, use that api key paired with the username returned from the sso auth flow?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [29 באפריל,‏ 2020,‏ 5:16pm UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/101 "2020-04-29T17:16:04Z")

</div>

> [@balupton](#):
>
> Or is the recommended way to create an `all users` api key, then when creating a post, use that api key paired with the username returned from the sso auth flow?

This is how our WordPress plugin handles it. The user’s Discourse username is saved to the database and then paired with the All User’s API Key to publish posts under that username.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [9 ביוני,‏ 2020,‏ 7:16pm UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/102 "2020-06-09T19:16:59Z")

</div>

> [@techAPJ](#):
>
> An http proxy (using golang) that uses [Discourse SSO](https://meta.discourse.org/t/13045?silent=true) to authenticate users (only Admins): [GitHub - discourse/discourse-auth-proxy: An http proxy that uses Discourse sso to authenticate users](https://github.com/discourse/discourse-auth-proxy) (made by

Hey everyone,

I have just released an important security fix for `discourse-auth-proxy`. Please make sure you download and apply the new code.

If you’re using our image from DockerHub, the version with the fix is `discourse/auth-proxy:20200609.185704`.

---

<div class="post-metadata">

### Author: ![sebastianh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sebastianh/32/40415_2.png) [@sebastianh](https://meta.discourse.org/u/sebastianh)
#### Post date: [6 באוגוסט,‏ 2020,‏ 4:32pm UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/103 "2020-08-06T16:32:26Z")

</div>

Wondering if anyone can improve upon some existing SSO plugins for Mediawiki (e.g. [Extension:PluggableSSO - MediaWiki](https://www.mediawiki.org/wiki/Extension:PluggableSSO) ) to make this work without need for too much tech skills (i.e. entering all necessary info on a settings page and whoopee)

---

<div class="post-metadata">

### Author: ![mdoggydog](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@mdoggydog](https://meta.discourse.org/u/mdoggydog)
#### Post date: [13 באוגוסט,‏ 2020,‏ 6:25pm UTC](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974/104 "2020-08-13T18:25:45Z")

</div>

> [@sebastianh](#):
>
> Wondering if anyone can improve upon some existing SSO plugins for Mediawiki

Please try this out:

[https://github.com/mdoggydog/DiscourseSsoConsumer](https://github.com/mdoggydog/DiscourseSsoConsumer)

It operates as a plugin for the PluggableAuth extension. I haven’t put this on any public-facing sites yet, and it sorely lacks unit/etc tests, but it does seem to work so far. It should not require any tech skills beyond those needed for installing/configuring any other MediaWiki extension.

[Previous page](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974.md?page=4)

[Next page](https://meta.discourse.org/t/use-discourse-as-an-identity-provider-sso-discourseconnect/32974.md?page=6)
