Skip to content

Commit

Permalink
fix the logout bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyuexrow committed Jan 3, 2019
1 parent 3ed9b25 commit f002baf
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions Resources/public/js/xrowrestOpenIDConnect.js
Expand Up @@ -209,11 +209,24 @@ function restLogout(redirectURL, sessionArray){
crossDomain: true,
url : oauthSettings.baseURL+oauthSettings.apiLogoutURL+'/'+sessionArray.session_id
}).done(function (logoutRequest) {
localStorage.removeItem(jwtProviderId);
if (redirectURL && redirectURL != '')
window.location.href = redirectURL;
else
location.reload();
// Destroy the session cookie on the current domain
// Assume that after reload the check-session-iframe will destroy the cookie on other domains
$.ajax({
type : 'DELETE',
xhrFields : {
withCredentials: true
},
crossDomain: true,
url : document.location.protocol +'//' + document.location.hostname + oauthSettings.apiLogoutURL + '/' +sessionArray.session_id
}).done(function (logoutRequest) {});
setTimeout(
function() {
localStorage.removeItem(jwtProviderId);
if (redirectURL && redirectURL != '')
window.location.href = redirectURL;
else
location.reload();
}, 2000);
});
}
else {
Expand Down

0 comments on commit f002baf

Please sign in to comment.