How to auto logout on facebook api?
How to auto logout on facebook api ?
I want to set up auto logout on facebook after inserting data from
facebook to the database.
I want user who connect on facebook automatyically logout without
redirecting to facebook and or opening another tab just to logout on
facebook.
I want this feature to be able for users connect multiple accounts on my
applications.
I have already tried auto logout in facebook using js sdk
Here is my code:
<script>
window.fbAsyncInit = function() {
FB.init({
appId:'MY_APP_ID', cookie:true,
status:true, xfbml:true,oauth : true
});
FB.Event.subscribe('auth.authResponseChange',
function(response) {
if (response.status === 'connected') {
FB.logout(function(response) {
window.location = '';
});
}
});
};
(function(d){
var js, id = 'facebook-jssdk', ref =
d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id;
js.async = true;
js.src =
"//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>"
but with this way the user will terminate the permission of the app.
I want the logout that like facebook normal logout, without affecting the
app connection.
Is there any way for this ?
Thank you.
No comments:
Post a Comment