Can I authenticate to Drupal via Discourse?

Is it possible to create user accounts in Discourse, then authenticate to Drupal using those accounts? I want Discourse to be where accounts live.

While searching, I seem to only find results talking about the opposite. Using Drupal as the authentication source.

My specific situation is that I have an instance of Discourse running for family members. I’d like to set up a recipe sharing site using Drupal 8, but I’d really rather not have to get my family to sign up for yet another thing. I’m already having very little luck getting them into Discourse…

Thanks in advance.

1 Like

Discourse can function as an SSO provider. It would be possible to set this up with Drupal, but I’m not aware of any existing Drupal modules for it. For details about what would be required see Use Discourse as an identity provider (SSO, DiscourseConnect).

If you’re not committed to using Drupal, the Discourse WordPress plugin allows you to use Discourse as the SSO provider for a WordPress site.

5 Likes

Why create a dependency that you may not need for a small number of users that may not use either? Two very different interfaces is a further barrier to their participation.

Consider two other options:

  • Use Discourse for the recipes too.
  • Use Drupal for both.
4 Likes

Thanks, that is exactly what I was searching for. :slight_smile:

What kind of authentication is that, anyway? OAuth, OpenID Connect? I feel like I should be able to tell from the description of how it works, but it just isn’t clicking.

Using the right tool for the right job is the short answer. Discourse is an amazing forum community software. Drupal, well, its forum module is really kind of sad.

Drupal is amazing at relating pieces of content together, trying to twist Discourse around to do what I can in Drupal would be insane. For example, Drupal’s Recipe module creates ingredients as their own individual entities. That means I can list ingredients I like on my profile, and then generate a list of recipes that I might like based on ingredients.

All that said, I also enjoy this kind of thing. It’s my day job, and my hobby. And, while the Discourse integration would be nice, ultimately the recipe site is mostly for myself. So it is useful even if I can’t get friends and family on it. :slight_smile:

4 Likes

It is Discourse’s own implementation of SSO. It is essentially the reverse of Setup DiscourseConnect - Official Single-Sign-On for Discourse (sso). If you’d like to look at some example code, the WordPress plugin’s SSO client code is here: wp-discourse/lib/sso-client at main · discourse/wp-discourse · GitHub. The trickiest part of implementing this on WordPress was dealing with the need for a unique nonce. Possibly that is something that will be easier to do with Drupal.

Any work that you do on Discourse/Drupal integration would be greatly appreciated!

4 Likes

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