Partially enable login option

We are currently integrating our Discourse community with a Discord server. We are using the Discourse Bot plugin. However, it requires to enable Discord Login to work.
We want to keep using our custom OAuth2 solution, but at the same time, allow Discord accounts linking.

Is there any way to enable the /auth/discord URL without actually enabling the login option?

1 Like

The easy thing here is just hidding the Discord button on the login modal with CSS.

3 Likes

Yeah, but this is not what we actually want to achieve. We already did that. :sweat_smile:

By hiding the button with CSS, you still force the modal to appear. Previosuly, by clicking the “Log In” button, it redirected to our OAuth2 server, and user was logged in with a single flow. Now, they see a modal and have to click in “with OAuth2”.
Is it possible to forward users to the OAuth2 when clicking “Log In”, having 2 auth options available?


With two options enabled, and hidding with CSS, users see this:

Ideally, they should be redirected to the OAuth2 flow as soon as they click the “Log In” button.

1 Like

Me and @Roman_Rizzi worked in a solution to this exact problem years ago. It wasn’t open source because it is quite a niche use case, but here it is:

https://github.com/discourse/discourse-excluded-logins

4 Likes

Thank you! That is exactly what we were looking for. :+1:

1 Like

This topic was automatically closed 0 minutes after the last reply. New replies are no longer allowed.