Skip to content

Commit

Permalink
Use the current session token when setting the auth cookies.
Browse files Browse the repository at this point in the history
Fixes issue when logging out from the mapped domain.

Fixes humanmade#14.
  • Loading branch information
r-a-y committed Oct 13, 2020
1 parent 55e3f01 commit c5c38ba
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sso.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ function get_login_url( $user, $args ) {
'action' => ACTION_LOGIN,
'key' => $key,
'nonce' => create_shared_nonce( 'mercator-sso-login|' . $key ),
'token' => wp_get_session_token(),
);
$admin_url = get_admin_url( $args['site'], 'admin-ajax.php', 'relative' );
$admin_url = add_query_arg( urlencode_deep( $url_args ), $admin_url );
Expand Down Expand Up @@ -554,7 +555,7 @@ function handle_login_response() {
}

wp_set_current_user( $token['user'] );
wp_set_auth_cookie( $token['user'], true );
wp_set_auth_cookie( $token['user'], true, '', $args['token'] );

// Logged in, return to sender.
wp_redirect( $token['back'] );
Expand Down

0 comments on commit c5c38ba

Please sign in to comment.