SSO with Wordpress and Discourse as Provider login Flow and logic

You could add a login link to your Discourse forum similar to this:

<a href="http://example.com/?discourse_sso=1&redirect_to=http://discourse.example.com">Login to WordPress and redirect back to Discourse</a>

The link should point to the base URL of your WordPress site. You need to set the discourse_sso=1 query parameter on the URL. The redirect_to parameter should be set to the URL you want to redirect users to.

It is possible to redirect users either to your WordPress site, or to Discourse with the redirect. I think that for most cases, it would be more useful to redirect users to the WordPress site instead of Discourse. For example:

<a href="http://example.com/?discourse_sso=1&redirect_to=http://example.com/shop">Login to WordPress from a Discourse post</a>

This could be done, but you will need to be careful about not locking yourself out of WordPress if anything goes wrong. A possible approach would be to put your WordPress /wp-login.php page behind a password that is only know to your WordPress site’s admins.