# Customized login auth plugin

**URL:** https://meta.discourse.org/t/customized-login-auth-plugin/49691
**Category:** Feature
**Created:** [September 4, 2016, 3:39am UTC](https://meta.discourse.org/t/customized-login-auth-plugin/49691 "2016-09-04T03:39:59Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Asoul](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@Asoul](https://meta.discourse.org/u/Asoul)
#### Post date: [September 4, 2016, 3:39am UTC](https://meta.discourse.org/t/customized-login-auth-plugin/49691/1 "2016-09-04T03:39:59Z")

</div>

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

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [September 4, 2016, 1:28pm UTC](https://meta.discourse.org/t/customized-login-auth-plugin/49691/2 "2016-09-04T13:28:33Z")

</div>

Discourse’s SSO support does exactly this:

> [@Setup DiscourseConnect - Official Single-Sign-On for Discourse (sso)](https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045):
>
> [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) is a core Discourse feature that allows you to configure “Single Sign-On (SSO)” to completely outsource all user registration and login from Discourse to another site. Offered to our [pro, business and enterprise hosting customers](https://discourse.org/pricing). information_source (Feb 2021) ‘[Discourse SSO](https://meta.discourse.org/t/13045?silent=true)’ is now ‘[DiscourseConnect](https://meta.discourse.org/t/13045?silent=true)’. If you are running an old version of Discourse, the settings below will be named sso\_... rather than discourse\_connect\_... The Problem Many sites wishing to integrate wit…

---

<div class="post-metadata">

### Author: ![Asoul](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@Asoul](https://meta.discourse.org/u/Asoul)
#### Post date: [September 4, 2016, 2:23pm UTC](https://meta.discourse.org/t/customized-login-auth-plugin/49691/3 "2016-09-04T14:23:50Z")

</div>

Hi @fefrei

I thought this SSO plugin is for external site authentication,  
not directly use [discourse connect](https://meta.discourse.org/t/13045?silent=true) to database for authentication.

Do I misunderstand that?

Thanks

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [September 4, 2016, 2:25pm UTC](https://meta.discourse.org/t/customized-login-auth-plugin/49691/4 "2016-09-04T14:25:13Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Asoul](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@Asoul](https://meta.discourse.org/u/Asoul)
#### Post date: [September 4, 2016, 2:29pm UTC](https://meta.discourse.org/t/customized-login-auth-plugin/49691/5 "2016-09-04T14:29:07Z")

</div>

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

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [September 4, 2016, 2:31pm UTC](https://meta.discourse.org/t/customized-login-auth-plugin/49691/6 "2016-09-04T14:31:13Z")

</div>

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 🙂
