SSO Configured but Not Working


(Taylor Johnson) #1

I configured SSO on my WordPress site for my Discourse site, but when I log into my WordPress site and then navigate to the Discourse site I am not automatically logged in. Is there any detailed documentation on the SSO? Something I am missing?


(Taylor Johnson) #2

I should add that I can successfully create posts to Discourse from WordPress, but for some reason am not logged into Discourse even though I am logged into WordPress.


(Simon Cossar) #3

Have you read through this? WP Discourse plugin installation and setup

When SSO is enabled, the plugin doesn’t automatically log you in to the Discourse forum. What it does is outsource the Discourse login operation to the WordPress site. If it’s working correctly, when you are logged into the WordPress site, clicking on the Login link on Discourse should automatically log you into the forum. If you are not logged into the WordPress site, clicking on the Login link on Discourse should redirect you to the WordPress site. After logging in on WordPress you should be redirected back to Discourse as a logged in user.

The plugin also generates ‘start the discussion’ or ‘continue the discussion’ links at the bottom of each post. By default, clicking on one of these links should log you in to WordPress (if you’re not already logged in) and then redirect you to the WordPress site as a logged in user.


(Nicolas Sebastiani) #4

Ok, I have the exact same issue as the OP.

I installed the WP plugin, configured the SSO options there as per the guide.
Configured the SSO options on discourse.
All seems fine since the WP plugin is saying connected.

But everytime I try to comment from a post, I see the link continue on discourse, and then I get redirected to the WP login page. Even though I’m already logged in.

Another thing that is weird (or maybe I don’t understand the process yet) is that when I register a new user on the WP site, it is not synced back to discourse.

Finally, I enabled logs to see what was going on but it looks like all the variables are empty. which might be the indicator of the issue, but I have no idea where to look next!

Any help would be appreciated.

here’s the log info

Verbose SSO log: Started SSO process

nonce: 5e9b9e69cdebcd86a031ae07d4e059b1
name:  
username: 
email: 
avatar_url: 
avatar_force_update: 
require_activation: 
bio: 
external_id: 
return_sso_url: http://discourse.mysite.com/session/sso_login // I notice here that the protocol is http when I configured https in the settings
admin: 
moderator: 
suppress_welcome_message: 
title: 
add_groups: 
remove_groups:

(Simon Cossar) #5

Does your configuration on WordPress and Discourse look something like this?


(Nicolas Sebastiani) #6

Thanks for the quick reply and the screenshot

I found my problem!

it was the sso url option. I had put the WP login page url and you didn’t, removing the wp-login.php from that option got it working.

it’s the endpoint description that got me confused!

Thanks again for your time!


(Simon Cossar) #7

Yes, I’ve got that setting wrong a few times myself. For WordPress, adding /wp-login.php to the URL doesn’t work, even though it seems like it should. Possible something could be done to fix that.

There are ways that this can be made to work, but that’s not how it works now. The Discourse user is created the first time they login to Discourse through WordPress.


(Nicolas Sebastiani) #8

Yes, I’ve got that setting wrong a few times myself. For WordPress, adding /wp-login.php to the URL doesn’t work, even though it seems like it should. Possible something could be done to fix that.

I’m not familiar with the code base of discourse, but just editing the description to be more specific seems fine to me.

There are ways that this can be made to work, but that’s not how it works now. The Discourse user is created the first time they login to Discourse through WordPress.

Yeah I saw that once I got the sso issue resolved, I see the user being created on the first login, which looks fine to me! I will need to play more with discourse to get familiarised with the application now that I got it working with WP. Thanks again for your help on this.