How to properly log out of facebook

Posted by Gublooo on Stack Overflow See other posts from Stack Overflow or by Gublooo
Published on 2010-05-08T18:34:52Z Indexed on 2010/05/10 19:24 UTC
Read the original article Hit count: 295

This is a repeated question and I have followed both the suggestions provided in these StackOverflow links:

The issue is - the code works 90% of the time. Thats the weird part. Out of the 100 times I've logged in and out - I've experienced this problem 5-6 times and 2 of my beta test users have reported the same issue.

So when it works- if u click the logout link - u get the facebook popup saying - you being logged out - when it does'nt work - absolutely nothing happens - the page does not refresh - it just sits on that page doing nothing.

This is the javascript code that gets called on clicking logout


function logout()
{
   FB.Connect.get_status().waitUntilReady(function(status) {
   switch(status) {
      case FB.ConnectState.connected:
        FB.Connect.logoutAndRedirect("http://www.example.com/login/logout");
        break;
      case FB.ConnectState.userNotLoggedIn:
        window.location = "http://www.example.com/login/logout";
        break;
}
});
return false;          
}


This is the php code:

$this->_auth->clearIdentity();
$face = Zend_Registry::get('facebook');
$fb = new Facebook($face['appapikey'], $face['appsecret']);
//$fb->clear_cookie_state();
$fb->expire_session();

Anyone experienced such sporadic issues. Thanks

© Stack Overflow or respective owner

Related posts about facebook-connect

Related posts about facebook