Example code for how a hosted solution would integrate with discourse

AI-generated summary

A hosted solution can integrate with Discourse’s login system using Single Sign-On (SSO). rubydoob is looking for sample code to enable this integration, similar to how Patreon allows its users to log in to Discourse. Falco provided several examples, including:

Additionally, for Ruby and Rails websites, Falco suggested copying the single_sign_on.rb file from the Discourse repository to the lib directory, and then adding a controller and route to handle SSO.

There are hosted solutions that allow for integrating with discourse.

Is there any sample code of what the hosted solution would have to do to integrate with discourses login system?

Example, patreon has a plugin that enables patreon users to login to discourse. I’m looking for sample code of what a hosted solution like Patreon would have to do on their end to allow for this type of integration.

I might have my terminology wrong but this would be Patreon as a SSO provider correct?

Thanks!

Oh we have a fair bit of examples on that:

https://github.com/topics/discourse-sso

If your website uses Ruby and Rails, you can copy and paste the file https://github.com/discourse/discourse/blob/master/lib/single_sign_on.rb on your lib directory to do all the heavy lifting and then add the necessary controller and route.