Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging out on another domain doesn't log the user out #14

Open
rmccue opened this issue Oct 7, 2014 · 5 comments
Open

Logging out on another domain doesn't log the user out #14

rmccue opened this issue Oct 7, 2014 · 5 comments
Labels

Comments

@rmccue
Copy link
Member

rmccue commented Oct 7, 2014

  • Log in to main domain
  • Go to alternative domain
  • Get logged in via SSO
  • Log out of the alternative domain
  • Next viewed page logs you back in via SSO

We should instead log out of the main domain, then sync that back across.

@rmccue rmccue added the bug label Oct 7, 2014
@rmccue
Copy link
Member Author

rmccue commented Nov 4, 2014

This should be fixable in 4.0 with session tokens, however we're kind of blocked on WP30247 to be able to share tokens across sites.

@scarstens
Copy link

@rmccue is this still an issue in 4.3.1? I tried testing this today with SSO enabled and it seemed to log me out everywhere.

@rmccue
Copy link
Member Author

rmccue commented Dec 9, 2015

I'm 99% certain this still needs to be done; when we create the new cookie, we need to use the existing session ID. r32465 (since 4.3) should have made this possible, we just need to use it.

@bjork
Copy link

bjork commented Feb 7, 2017

I was having this issue, but I could not easily figure out how to actually fix it properly, even with the pointers above. For others that might have the same issue, here is my workaround. It destroys all the sessions the user that is logging out might have.

add_action( 'wp_logout', function () {
	$sessions = WP_Session_Tokens::get_instance( get_current_user_id() );
	$sessions->destroy_all();
} );

r-a-y added a commit to r-a-y/Mercator that referenced this issue Oct 13, 2020
Fixes issue when logging out from the mapped domain.

Fixes humanmade#14.
@r-a-y
Copy link
Contributor

r-a-y commented Oct 13, 2020

Just encountered this issue.

bjork's solution destroys all user sessions, which is kind of a brute-force workaround.

I've added a PR (#117), which does what rmccue states above: #14 (comment). If you're testing this PR, ensure you are logged out on the main site and on your mapped domain(s) beforehand. Then attempt to login on the main site. Next, open a new tab and navigate to the mapped domain. Lastly, attempt to logout from the mapped domain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants