Two User Database for Forum (Discourse) and App (Rails/Devise), SSO?

Hi Upcase,

I am asking for suggestions on some problem I am facing.
We have a rails app hosted in Heroku, but we have another forum (Discourse) on Digital Ocean.

How can I structure the system where our App user don’t have to signup twice?
I don’t want App user to sign up twice for the App and Forum.

We don’t want all Forum users to be an App users, but want all the App users to automatically be Forum users…

I hope I am making sense.

Any tips will be greatly appreciated!

Single Sign On (SSO) is a feature thats built into Discourse. In fact, we’re using it on this very forum with the Upcase app, and you have access to that code.

The relevant controller is here upcase/forum_sessions_controller.rb at master · thoughtbot/upcase · GitHub

It uses the DiscourseSignOn class.

Once your app has this functionality in it (the Upcase app also has specs for the functionality, be sure to look at them) then there are settings in the Discourse admin that you can enable to enable SSO against your Rails app.

Let me know if you have any more questions or issues with any of this. Good luck!

-Chad

3 Likes

Hi @cpytel,
I’m getting a 404 when I click that link.

Perfect! Another reason why Upcase is so amazing. Thanks for the tip @cpytel!

These were some good read too for others who might implement SSO:
Official Discourse SSO: DiscourseConnect - Official Single-Sign-On for Discourse (sso) - developers - Discourse Meta
Learn Discourse: learndiscourse.org
Stackoverflow: Incorporating Discourse SSO with Existing Rails Site with Devise - Stack Overflow

Please be sure you are logged into GitHub and then visit Upcase by thoughtbot | Learn Web Development Online to visit the repositories for the first time to make sure you have access.

Thank you!