Discourse handling login for the main website


(Gautham N S) #1

There is now an excellent way to integrate discourse with our own users using the official SSO plugin.

But I’m starting a new website and see that discourse has excellent login mechanism, complete with username password, Google, Twitter, Facebook logins etc. Is there a way I can share users across my main website and Discourse with Discourse handling the User login so that I need not re-invent the wheel?


(Igor Da Cruz) #2

Complementing my question, which is basically the same:

You can insert a box Sign Up / Log In for forum on a page outside the forum? Once logged in (or register) the user would be automatically directed to the environment Discourse.

The idea is to introduce information about the forum in one simple page and provide access already performing the action log in or register.

Do not know much about programming code, and do not know if this would be an impossible task, would it?


(Igor Da Cruz) #3

@gauthamns I think the answer is that we want this topic:
https://meta.discourse.org/t/merging-authentication-with-our-website/7785?source_topic_id=18958

@codinghorror you could just confirm that is it?

thanks


(Salman, Freelance Developer) #4

Another option is to install discourse on the main URL, and then create a new page that anonymous (not logged in users) would see. On this ‘welcome’ page you could all the text you want, and re-use the existing disourse header with the login functionality. Once the user logs in, you display the original discourse main page. So you are really just creating a new ‘welcome’ page that people get redirected to when not logged in, which will re-use the existing header.

Note: This assumes you discourse is still publicly viewable, just the front page changes depending on if you are logged in or not.


(Igor Da Cruz) #5

@rubydoob Your solution is interesting, thanks for sharing with us


(James Didehvar) #6

Apart from what @rubydoob suggested is there any other way of doing this? Its a hard thing to search for as I’m just getting results back for using Discourse SSO.

Simply put if you were making a new app would it be possible to login users through Discourse? For example, if you have a Discourse forum with a whole bunch of users and then decide you want to build an app that your users can log into?

I’m guessing each Discourse instance isn’t an OAuth provider, so would this be possible to implement through a plugin (perhaps one that is the opposite of Discourse SSO) - or is there an easier way?


(Ernest Lee) #7

I was able to write a database adapter for Casino (a CAS server) that reads the Discourse database to provide sso logins to anyone using the CAS protocol.

This allows me to use the Casino server to allow gitlab logins and anything that integrates with CAS. There was an issue where if the person uses Google or other oauth logins, the CAS server will not allow login. It only allows plain username:password pairs.

Oauth is another method.

Hope this helps.


(Sam Saffron) #8

There are no results cause it has not been done yet :slight_smile:

Plenty of options, probably simplest is creating a plugin that adds the endpoints you need