Make Discourse SSO Master (SSO Client)

(Adam Adam) #1

how do I make discourse the SSO client (as its called on the WP plugin). So that users have to sign-up/login through discourse. And how do I make it so they can sign-in/sign-up right on wordpress, but using discourse sign in/up. Is that possible?

I noticed that wordpress is allowing this. Although, over on discourse, I only see the option to
“Enable single sign on via an external site”.


(Simon Cossar) #2

On Discourse you need to select the ‘enable sso provider’ setting that is in your screenshot. Do not select the ‘enable sso’ setting.

You need to enter the SSO Secret key that you have set on WordPress in the Discourse ‘sso secret’ setting.

On WordPress, click on the SSO Client tab that is in your screenshot to configure the SSO Client settings. There are some instructions there for setting it up.

(Adam Adam) #3

For some reason when I created an account on discourse and tried signing in with the account on wordpress, it did not work?

(Simon Cossar) #4

Did you get an error message? If not, what happened when you tried logging in?

(Adam Adam) #5

Here are some screenshots. I have confirmed my email via discourse as well. And I even tried on my themes login vs wordpresses login to see if that would help. I even tried clicking the “login with discourse” link but no luck


I have NOT touched settings under “SSO Provider”

(Simon Cossar) #6

When you clicked the Log in with Discourse button, were you being redirected to Discourse? You don’t need to enter your username or password on the WordPress login page. It’s just like logging in with Facebook or another social login provider.

(Adam Adam) #7

Clicking login with discourse button worked

(Simon Cossar) #8

Great! That’s how it is expected to work. It would be clearer for users if the text was styled as a button.

(Adam Adam) #9

Makes sense. So basically people cant just sign in regularly using the credentials they setup on discourse?

Will they only have to use the “sign in with discourse” link once, and then after that they can just sign in regularly with their credentials?

(Simon Cossar) #10

If they want to sign in through WordPress after having first created an account by signing in with Discourse they will need to go through the password reset process. If they had first created their WordPress account through the normal WordPress signup, they will be able to sign in through either method - the initial password that they used on WordPress will be retained.

It works in the same way as Facebook login.

(Adam Adam) #11

I want it so logins, signups, and avatars are controlled by discourse.

I am thinking of setting it up like so:
(the arrows represent redirects to URLs)
wordpress Sign-up link ----> discourse sign up
wordpress user “my profile” link ----> discourse profile
wordpress sign in link -----> “sign in with discourse button”

The reason I want to use discourse is because I like the setup, emails, profile, etc…
But the reason I need sign ins to my site is because, in order for users to post on my “marketplace” & “stories” they need to sign-in. So that I can keep records on users.

What do you think about this setup. Any reccomendations?
Should I just use wordpress to handle logins/signups?
What do you think is the most effective, user friendly & efficient way of doing this based on my situation?

Also is there a link to send people to their own profiles on discourse, & is there a link I can use instead of this shortcode [discourse_sso_client login=‘Login Through the Forum’]

Thanks alot for the help man!

(Sami Syed) #12

Anyone know how to do this?

(Sami Syed) #15

How could I make it so avatars on discourse also appear on wordpress. Also, how do I set it up so when users click the avatar or profile link they are sent to corresponding users profile on discourse

(Simon Cossar) #16

You would need to get the user’s avatar_url from Discourse through the API. Then you would need to figure out how to get the avatar to display on WordPress. It’s not something that the WP Discourse plugin is ever going to do. I think that doing this will mostly make your users mad, they won’t be expecting to load Discourse when they click on a WordPress avatar.

(Sami Syed) #17

Okay then,

I have a link in users profile called “My Profile” which takes users to their discourse profile. Is there a link I can use to direct signed in users to their corresponding discourse profile?

(Simon Cossar) #18

You can get the Discourse Username for users who have logged into WordPress through Discourse with something like this (you need to know their WordPress user_id first.):

$discourse_username = get_user_meta( $user_id, 'discourse_username' , true );

Once you know the username, you can construct a link to their Discourse user page like this:

$discourse_profile_link = "{$discourse_username}/summary";

(Sami Syed) #19

So I would have to do this for each user?