Customized login auth plugin

Hi, I’m new to discourse,

I want to create a plugin for customized login that contains below feature:

  • No signup button on homepage, and can not create new account in discourse
  • After click signin button, user will be authenticate to external database
  • After authentication, get user information and login to discourse

Is there any document or sample code for that? or these feature has already done before?

Thanks

Discourse’s SSO support does exactly this:

1 Like

Hi @fefrei

I thought this SSO plugin is for external site authentication,
not directly use discourse connect to database for authentication.

Do I misunderstand that?

Thanks

I’m not sure I understand the difference between these two options.

SSO means that Discourse will ask an external application to handle authentication, which can then use its database to handle the requests.

Yes, that’s a way to do it.

But for me there is no the “external application” now, so I’m wondering which one is simpler

  1. Build an external app connect to database, and build the SSO part
  2. Build an discourse plugin connect to database for authentication

The second option is a world of pain, because there are a ton of edge cases in using an external user database, most of which are already handled beautifully by Discourse’s SSO implementation.

Go for option one, and build a thin app to handle SSO. Remember that your users don’t have to know about SSO at all – you can style the login prompt as you wish to make this all seamless :slight_smile:

6 Likes