Redirecting not working when using together with Discourse SSO


I am experiencing problems with redirection after login at certain circumstances

I have following setup:

  • Wordpress website with Patreon Plugin (Patreon login enabled).
  • Discourse website, configured to authorize through Wordpress via SSO.

So, when user trying to authorize on Discourse, he is redirected to Wordpress website, enters his username/password and after successful authorization he is redirected back to Discourse.

But, as mentioned above, we also have Patreon Login configured (for Wordpress).

So, when user is redirected from Discourse to Wordpress, he can click “Login with Patreon” button and authorize there. The problem is that user is not properly redirected back to Discourse after that.

Here I have recorded a video showing the problem -

Note-1: When user authorizing directly from Wordpress website by clicking “Login with Patreon” button, then redirecting works fine.

Note-2: When user authorizing from Discourse without clicking “Login with Patreon” button, then redirecting also works fine.

One of Discourse developers noted:

What I think is causing the problem is that the WordPress Patreon plugin is stripping the sso and sig query parameters that are sent with the Patreon login request.

Any help is appreciated! :slight_smile:

Okay, I have found a workaround for the issue, posted it here - Wordpress SSO AND Patreon Login - #9 by morevnaproject - wordpress - Discourse Meta

Of course it would be nice to have a proper fix for the problem. :slight_smile:

In such a case you would need to catch the redirection and append the parameters. There are already filters for that.

There cant be a proper fix for that since there isnt anything particularly needing fixed - the setup in your site is a modification which needs accounting for different formats of login. We cant account for such cases because modifications that can be done in that manner are endless. That’s why there are filters.

Checking redirects through redirect filter and catching any sso parameters and redirect_uris if they exist, then re-appending them if they are lost in any point in redirect sequence would work.