Discourse as SSO provider for Wordpress multisite

Hello @simon

Thanks for helping me our earlier today.

Following on the earlier question: I do have a multiste install on Wordpress. May I use Discourse as SSO provider for WP sites? What are the limitations? and anything I should know before making the move?

Ehsan

1 Like

Yes, you can use Discourse as the SSO provider on a multi-site network. It is only enabled if you setup a single Discourse site as the SSO provider for all sites on the network. The reason for this is that on a multisite network all users are stored in a single database table. If multiple Discourse sites are allowed to function as the SSO provider for multiple sites in a network, there is no straightforward way to guarantee that the Discourse user ids saved on WordPress are unique.

When the WP Discourse plugin is installed on a multisite network, a Discourse tab is added to the Network Admin menu. To configure Discourse as the SSO provider for all sites on the network, go to the Network Admin page and select Discourse from the menu. Select the ‘Enable Multisite Configuration’ option and then fill in the Connection Settings. Then scroll down the page to the SSO Settings section. Select the ‘Enable SSO Client’ option. Enter your SSO Secret Key and save the settings page.

One thing to be aware of is that enabling the SSO Client functionality on a multisite network will potentially give access to any user on your Discourse forum to any site on your network.

2 Likes

Many thanks Simon for the detailed explanation!

Will go ahead and set it up and report back if I encounter any issue

2 Likes

Hello @simon

Most of the parts being figured on the multisite. Thanks!

Now there is another issue:
When user logs in / out from wp, they logs in / out from Discourse too but, when user logs in or out from Discourse, nothing happens on WP. How could I make this a two way setup/

You can do this by setting the logout redirect site setting on your Discourse forum to the home URL of your WordPress site and adding the query parameter ?request=logout. For example:

https://example.com/?request=logout
3 Likes

Thanks.

I already did that. When I logout from Discourse, it redirects to the homepage as you mentioned with no problem. the challenge is, when user logs out from discourse, they redirect to homepage but, the user is still signed in in subsides. Even after refreshing the page, they are still loved in.

1 Like

Did you include

?request=logout

?

yes. here is the full version:

I’ll look into this. I don’t have a multisite installation online at the moment so it might take a few days to get to it. I do test the plugin against a multisite install from time to time.

It seems that the issue is that users are not being logged out of subsites when they are logged out of the main site. I think that is something that can be solved with WordPress configuration, but I could be wrong. If you find a way to get this to work on your site, please let us know.

1 Like

I will . Thanks for your help.

By the way, I can give you admin access to both WP and discourse site we have If that makes things easier.

I seem to remember @itsbhanusharma having an issue with multisite logout in the past. Is that correct? If so, did you ever get it resolved?

3 Likes

I didn’t get it resolved directly, I just got settled with auth0 and called it a day.

Would still be interested in getting it to work directly in discourse though!

3 Likes