SSO redirect to


(Adam Adam) #1

I am using discourse as an sso provider to wordpress. Meaning discourse handles all user authentication (login, signup, profile, etc…)

How do I set it up so that when a user logs in from wordpress and sent to the forum for login, they get redirected back to the page they were on. Because right now after a user logs in no matter where on the site they were, they get sent back to the home page of my WP site


(Simon Cossar) #2

If you use the [discourse_sso_client] shortcode, it will create a login link for you that should redirect users back to the WordPress page that they clicked the login link on. Note, the [discourse_sso_client] shortcode will not display a link for users who are already logged into your site.

You can also create a link yourself that should redirect users to a specified WordPress page after logging in through Discourse. Set the redirect_to value to the URL of the WordPress page you want people to end up on.

<a href="http://wpdiscourse.test/?discourse_sso=1&redirect_to=http://wpdiscourse.test/my-blog-post">Log in with Discourse</a>

(Sami Syed) #3

So its not possible to redirect to the page the user was originally on?


(Simon Cossar) #4

Yes, you can either do that yourself by writing some code that will detect what page the user is on and then using that value to set the redirect_to parameter, or you can use the shortcode. The shortcode should take care of setting the redirect for you.