# Problems with WP Multisite SSO

**URL:** https://meta.discourse.org/t/problems-with-wp-multisite-sso/30509
**Category:** SSO
**Tags:** discourseconnect
**Created:** [2015年六月26日 19:34 UTC](https://meta.discourse.org/t/problems-with-wp-multisite-sso/30509 "2015-06-26T19:34:31Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Jason\_Lorje](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@Jason\_Lorje](https://meta.discourse.org/u/Jason_Lorje)
#### Post date: [2015年六月26日 19:34 UTC](https://meta.discourse.org/t/problems-with-wp-multisite-sso/30509/1 "2015-06-26T19:34:31Z")

</div>

Hi there

I am battling to figure out SSO, it seems like there are different ways that one can implement SSO, but whatever I do seems to break something.

This is my set up:

- Wordpress multisite (not blog farm, all subsites of main site)
- Discourse hosted plan
- Currently using plugin [WP Multisite SSO](https://wordpress.org/plugins/wp-multisite-sso/) to manage SSO to network
- Login from any of the sites (including subsites) logs in to the entire network
- Installed [WP Discourse](https://github.com/discourse/wp-discourse) plugin.

What I am trying to achieve:

- Add discourse as a site on the network with the following implications,
  - Log in from any of the sites also seamlessly logs in to discourse and viceversa

My questions are the following.

- Is my desired setup possible or are the SSO plugins clashing ( I could also use [WP Multisite User Management](https://wordpress.org/plugins/multisite-user-management/))
- What do I enter on WP side and Discourse side, specifically do I enable ‘enable sso provider’ and what is my sso url - a) [mysite.com/discourse/sso](http://mysite.com/discourse/sso) or b) [discourse.mysite.com](http://discourse.mysite.com).
- If a) do I need to create a template and if so how (no template shows up currently)

Thanks in advance for any help.

Regards  
Jason

---

<div class="post-metadata">

### Author: ![Jason\_Lorje](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@Jason\_Lorje](https://meta.discourse.org/u/Jason_Lorje)
#### Post date: [2015年六月27日 10:40 UTC](https://meta.discourse.org/t/problems-with-wp-multisite-sso/30509/2 "2015-06-27T10:40:42Z")

</div>

Update:

I have now activated sso via WP plugin and in discourse. When I try to link to my forum I get: The webpage at [http://pods.myenterpride.com/session/sso](http://pods.myenterpride.com/session/sso) has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.

I can also not get into my admin account via /users/admin-login I am getting [‘BAD CSRF’]

---

<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: [2015年六月27日 10:54 UTC](https://meta.discourse.org/t/problems-with-wp-multisite-sso/30509/3 "2015-06-27T10:54:22Z")

</div>

To get back into your site, try to open a private tab to use `/users/admin-login`.  
If this doesn’t work, ssh into your server and use [these](https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045/64) instructions to manually disable SSO.

---

<div class="post-metadata">

### Author: ![Jason\_Lorje](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@Jason\_Lorje](https://meta.discourse.org/u/Jason_Lorje)
#### Post date: [2015年六月27日 10:56 UTC](https://meta.discourse.org/t/problems-with-wp-multisite-sso/30509/4 "2015-06-27T10:56:50Z")

</div>

I can’t ssh, it is hosted by discourse. I don’t have server details.

---

<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: [2015年六月27日 11:00 UTC](https://meta.discourse.org/t/problems-with-wp-multisite-sso/30509/5 "2015-06-27T11:00:23Z")

</div>

Oh, sorry, I didn’t see your `customer` title.

Did you try [http://pods.myenterpride.com/users/admin-login](http://pods.myenterpride.com/users/admin-login) in a private tab? I can see and submit the form.

* * *

I think that your SSO url is wrong. I was redirected to `http://pods.myenterpride.com?sso=<token>&sig=<signature>`, which is the domain of your Discourse installation. While I have no idea about the WP side of things, this needs to point somewhere where WP handles it.  
`

---

<div class="post-metadata">

### Author: ![Jason\_Lorje](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@Jason\_Lorje](https://meta.discourse.org/u/Jason_Lorje)
#### Post date: [2015年六月27日 11:03 UTC](https://meta.discourse.org/t/problems-with-wp-multisite-sso/30509/6 "2015-06-27T11:03:57Z")

</div>

Yes I did. But i get [‘BAD CSRF’] and no mail

---

<div class="post-metadata">

### Author: ![Jason\_Lorje](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@Jason\_Lorje](https://meta.discourse.org/u/Jason_Lorje)
#### Post date: [2015年六月27日 11:13 UTC](https://meta.discourse.org/t/problems-with-wp-multisite-sso/30509/7 "2015-06-27T11:13:42Z")

</div>

OK, thanks. I am in. You are a hero 😃

I think I will wait for an official input before I reactivate SSO. Everytime I try something it breaks.

---

<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: [2015年六月27日 11:15 UTC](https://meta.discourse.org/t/problems-with-wp-multisite-sso/30509/8 "2015-06-27T11:15:25Z")

</div>

Sounds reasonable.

I’m still intrigued by the `BAD CSRF`. I literally didn’t do anything than opening a new private tab in chrome, put in your E-Mail address, submitted the form, and got a confirmation…

---

<div class="post-metadata">

### Author: ![Jason\_Lorje](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@Jason\_Lorje](https://meta.discourse.org/u/Jason_Lorje)
#### Post date: [2015年六月27日 11:16 UTC](https://meta.discourse.org/t/problems-with-wp-multisite-sso/30509/9 "2015-06-27T11:16:45Z")

</div>

I know. I tried opening an incognito tab several times, with the same result. Thanks anyway.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2015年六月29日 05:15 UTC](https://meta.discourse.org/t/problems-with-wp-multisite-sso/30509/10 "2015-06-29T05:15:00Z")

</div>

Your situation sounds very complex. You may need to wait until business weekdays for us to help. We generally do not work weekends unless something is on fire.

---

<div class="post-metadata">

### Author: ![AdamCapriola](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adamcapriola/32/5192_2.png) [@AdamCapriola](https://meta.discourse.org/u/AdamCapriola)
#### Post date: [2015年六月30日 01:37 UTC](https://meta.discourse.org/t/problems-with-wp-multisite-sso/30509/11 "2015-06-30T01:37:40Z")

</div>

Hey @Jason_Lorje, I think your setup can work as long as:

1. Users have the same ID across all of the sites
2. You have one login page that logs the users into all sites at once

It sounds like the WP Multisite SSO plugin might do all of that.

If you’re comfortable doing some coding, try following my integration guide one piece at a time:

[https://meta.discourse.org/t/wordpress-integration-guide/27531](https://meta.discourse.org/t/wordpress-integration-guide/27531)

The only part I’m unsure will work for you is the `wp_login_url` function; it depends how multisite and the SSO plugin handle it.

You do _not_ want to check `enable sso provider`. These are the only options I enable:

 ![](https://global.discourse-cdn.com/meta/original/3X/e/a/ea901a1f25746724fcfc2ab2db5907e9a1a3cc79.png) 

 ![](https://global.discourse-cdn.com/meta/original/3X/7/9/79cba74296e8e9c43ea2709dac600cbdae497fcd.png) 

I hope that helps!

---

<div class="post-metadata">

### Author: ![Jason\_Lorje](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@Jason\_Lorje](https://meta.discourse.org/u/Jason_Lorje)
#### Post date: [2015年六月30日 10:30 UTC](https://meta.discourse.org/t/problems-with-wp-multisite-sso/30509/12 "2015-06-30T10:30:00Z")

</div>

@codinghorror @fefrei @AdamCapriola

Thank you all for your input, I have solved the problem 🎉 For those that may follow this thread, and are trying to connect discourse to a WP multisite here is what you shouldn’t and should do.

Don’t use WP Multisite SSO plugin, it breaks everything. Use WP Multisite User Management instead.  
@AdamCapriola Sorry mate, I couldn’t get your plugin to work, probably my lack of coding experience, though.

What worked:  
**On the WP side:** Use the [WP Discourse](https://github.com/discourse/wp-discourse) plugin, Check the ‘Enable SSO to Discourse’, check that all user ID’s are the same across the network.  
**On Discourse side:** Enable SSO, Enable SSO Provider, and set URL to [yoursite.com](http://yoursite.com/session/sso_provider) (for some reason I overlooked this 😳), override e-mail, override username and set not approved url. Clear all caches and test incognito.

Voila, it works, or at least it did for me.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2015年七月11日 01:45 UTC](https://meta.discourse.org/t/problems-with-wp-multisite-sso/30509/13 "2015-07-11T01:45:21Z")

</div>


