Redirected to Wordpress dashboard after discourse login


(Martin Ovsenak) #1

We use discourse together with wordpress, which is the sso provider.
After latest update of discourse docker container and the wp discourse plugin, I am not able to access discourse forums while logged in. It always redirects to the Wordpress dashboard, after entering the credentials, instead of showing main Discourse page.

I suspect that it is some simple discourse redirection causing this, can somebody advice where to look first, what can be causing this? The discourse admin pages became inaccessible because of this issue, but I can edit things on commandline,of course.

Thank you
Martin


(Simon Cossar) #2

Can you check the SSO settings on WordPress and make sure they are still enabled? It’s possible that they were disabled during the update.


(Simon Cossar) #4

I’m not able to reproduce this. Can you let me know if it continues to be a problem?


(Martin Ovsenak) #5

Simon, thanks for reply. I checked the plugin status and it is activated. After forum searching, I am now able to access discourse admin pages using sso bypass ( /users/admin-login url ). I will check all the related sso options on Discourse side. The issue persists.
Martin


(Simon Cossar) #6

It’s possible that there is an issue with the SSO redirect from WordPress to Discourse that occurs after authentication on WordPress. Do you know if you have any other WordPress plugins installed that could be altering the ‘allowed_redirect_hosts’?


(Martin Ovsenak) #7

Simon, thanks for advice.

Temporarily solved by adding our discourse host to the hosts array in allow_discourse_redirect function manually.
Would it be of use to add this list of hosts to the Discourse sso configuration in wp Dashboard?


(Simon Cossar) #8

From what I understand about your setup, you have two URLs pointing at your forum, with the first one redirecting to the second one. I’m not sure if an option should be added to the plugin for dealing with that situation.

For now, instead of editing the plugin’s code, you can add to the allowed hosts array in your theme’s functions.php file by doing something like this:

function your_namespace_allow_extra_redirect( $hosts ) {

	$hosts[] = 'yourseconddomain.com';

return $hosts;
}
add_filter( 'allowed_redirect_hosts', 'your_namespace_allow_extra_redirect' );