hello have problem logout method of facebook sdk api. doesnt close session. want close in onload of index theres method
<script type="text/javascript"> function cerrarsesion() { fb.auth.setauthresponse(null, 'unknown'); fb.getloginstatus(function(response) { if (response && response.status === 'connected') { alert(response.status); fb.logout(function(response) { document.location.reload(); }); } }); }); </script> i call method in onload of index doesnt works
<body onload="cerrarsesion();">
instead of on onload, perform logout event after sdk has initialized if fb.getloginstatus shows user indeed logged in:
window.fbasyncinit = function() { fb.init({ appid : '{your-app-id}', cookie : true, // enable cookies allow server access // session xfbml : true, // parse social plugins on page version : 'v2.2' // use version 2.2 }); fb.getloginstatus(function(response) { if (response.status === 'connected') { fb.logout(); } }); }
Comments
Post a Comment