title: Facebook API - Session still exists after user logout
body: <p>I am using Facebook php-sdk in my iframe facebook app to get user login status.
  Right after I sign out using facebook Account > Log out link, the session is not destroyed yet. I must wait a few minutes before old session expires, then my app will again get the correct login status.</p>
  
  <p>I expect the facebook to kill itself and the session when user signs out. How do I manually kill the session?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>$initParams = array(
    'appId'  =&gt; $conf['app_id'], 
    'secret' =&gt; $conf['secret_api_key'],
    'cookie' =&gt; TRUE,
  );
  
  $fb = new Facebook($initParams);
  $fb-&gt;getSession();  // will return a session object eventhough user signed out!
  </code></pre>
  
  <p><strong>SOLVED:</strong></p>
  
  <p>calling <code>$fb-&gt;api('/me')</code> will destroy the session if user has previously logged out.
  I've changed my code as following:</p>
  
  <pre><code>if ($session)
  {
      try
      {
          $fbuid = $fb-&gt;getUser();
          $me = $fb-&gt;api('/me');
      }
      catch(FacebookApiException $e){}
  }
  </code></pre>
  
  <p>If the API call is unsuccessful, <code>$session</code> will be set to NULL. Very weird behavior, I don't explain everything that is going on here but it solved my problem of having residual session object not being updated via <code>getSession()</code> method.</p>