Answer the question
In order to leave comments, you need to log in
Is it possible to fully logout in the facebook api javascript from the application and from the system at once?
Good afternoon,
Created a WEB application in the FACEBOOK API. Made it public.
Connected API:
window.onload = function(){
window.fbAsyncInit = function() {
FB.init({
appId : '*****',
xfbml : true,
version : 'v2.7'
});
};
}
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/ru_RU/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
<button id="log_in_fb">Auth FB</button>
<button id="log_out_fb">Log out FB</button>
$('#log_in_fb').click(function(){
FB.getLoginStatus(function(response) {
if(response.status === 'connected') {
console.log('Logged In');
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
}
else{
FB.login(function (response){
if(response.status === 'connected') {
console.log('Авторизован везде');
}
else if (response.status === 'not_authorized') {
console.log('Пользователь авторизован в Facebook, но не авторизован в приложениии')
} else {
console.log('Пользователь не авторизован в Facebook.')
}
}, { scope : 'public_profile, email, user_friends' });
}
});
});
$('#log_out_fb').click(function(){
FB.getLoginStatus(function(response) {
console.log(response.status);
if (response && response.status === 'connected') {
FB.logout(function(response) {
console.log('logout');
});
}
});
});
Answer the question
In order to leave comments, you need to log in
I recommend not dwelling on the moment you log out of Facebook. This is a different site that has nothing to do with yours.
Logout is described here https://developers.facebook.com/docs/reference/jav ...
You can try opening https://www.facebook.com/logout.php in a hidden iframe to kick the Facebook session out of the browser. Not the prettiest solution, but should work.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question