Based on this , I implemented the following client solution (earlier I ask if the user wants to leave the provider):
//get accountType, accessToken, redirectUrl and clientID var accountType = ...; var accessToken = ...; var redirectUrl = ...; var clientID = ...; $("#logoutConfirmButton").on('click', function () { externalLogout(); }); function externalLogout() { var url, params; if (accountType== "facebook") { url = "https://www.facebook.com/logout.php"; params = { next: redirectUrl, access_token: encodeURIComponent(accessToken) }; performCallLogout(url, params, accountType); } else if (accountType== "google") { url = "https://www.google.com/accounts/Logout?continue=https://appengine.google.com/_ah/logout"; params = { next: redirectUrl } performCallLogout(url, params, accountType); } else if (accountType == "microsoft") { url = "https://login.live.com/oauth20_logout.srf"; params = { clientId: clientID, redirectUrl: redirectUrl } performCallLogout(url, params, accountType); } } function performCallLogout(url, params, accountType) { if (accountType == "facebook") { window.location.href = url + "?next=" + params.next + "&access_token=" + params.access_token; } else if (accountType == "google") { window.location.href = url + "?continue=" + params.next; } else if (accountType == "microsoft") { window.location.href = url + "?client_id=" + params.clientId + "&redirect_url=" + params.redirectUrl; } }
Hope this helps someone.
source share