title: Facebook PHP SDK Error validating access token
body: <p>starting from a thinkdiff.net <a href="http://thinkdiff.net/facebook/php-sdk-graph-api-base-facebook-connect-tutorial/" rel="nofollow">tutorial</a>  I have built a simple test page (local env) with a facebook login/logout link.If logged in i want to echo out the fb user API.</p>
  
  <p>Im using the latest <a href="https://github.com/facebook/php-sdk/" rel="nofollow">facebook PHP SDK (v.2.1.2)</a>.</p>
  
  <p>It seems to work but when i logout I receive this exception:</p>
  
  <pre><code>FacebookApiException Object
  (
  [result:protected] =&gt; Array
      (
          [error] =&gt; Array
              (
                  [type] =&gt; OAuthException
                  [message] =&gt; Error validating access token: The session is invalid because the user logged out or because auth.expireSession was invoked.
              )
  
      )
  
  [message:protected] =&gt; Error validating access token: The session is invalid because the user logged out or because auth.expireSession was invoked.
  [string:Exception:private] =&gt; 
  [code:protected] =&gt; 0
  [file:protected] =&gt; C:\wamp\www\fb\facebook.php
  [line:protected] =&gt; 543
  [trace:Exception:private] =&gt; Array
      (
          [0] =&gt; Array
              (
                  [function] =&gt; _graph
                  [class] =&gt; Facebook
                  [type] =&gt; -&gt;
                  [args] =&gt; Array
                      (
                          [0] =&gt; /me
                      )
  
              )
  
          [1] =&gt; Array
              (
                  [file] =&gt; C:\wamp\www\fb\facebook.php
                  [line] =&gt; 492
                  [function] =&gt; call_user_func_array
                  [args] =&gt; Array
                      (
                          [0] =&gt; Array
                              (
                                  [0] =&gt; Facebook Object
                                      (
                                          [appId:protected] =&gt; 1819654718*****
                                          [apiSecret:protected] =&gt; a2fccb8e93638b50c8d6b2**********
                                          [session:protected] =&gt; 
                                          [signedRequest:protected] =&gt; 
                                          [sessionLoaded:protected] =&gt; 1
                                          [cookieSupport:protected] =&gt; 1
                                          [baseDomain:protected] =&gt; 
                                          [fileUploadSupport:protected] =&gt; 
                                      )
  
                                  [1] =&gt; _graph
                              )
  
                          [1] =&gt; Array
                              (
                                  [0] =&gt; /me
                              )
  
                      )
  
              )
  
          [2] =&gt; Array
              (
                  [file] =&gt; C:\wamp\www\fb\fb.php
                  [line] =&gt; 33
                  [function] =&gt; api
                  [class] =&gt; Facebook
                  [type] =&gt; -&gt;
                  [args] =&gt; Array
                      (
                          [0] =&gt; /me
                      )
  
              )
  
      )
  
  [previous:Exception:private] =&gt; 
  )
  </code></pre>
  
  <p>this is my test page code</p>
  
  <pre><code>$fbconfig['appid']  = "18196**********";     
  $fbconfig['api']  = "5c6910be575e4e688ac6d**********";     
  $fbconfig['secret']  = "a2fccb8e93638b50c8d6b2**********"; 
  
  try
  {         
     include_once "facebook.php"; 
  }     
  catch(Exception $o)
  {         
   echo '&lt;pre&gt;';         
   print_r($o);         
   echo '&lt;/pre&gt;';     
  }     
  // Create our Application instance.     
  $facebook = new Facebook(array('appId'  =&gt; $fbconfig['appid'],'secret' =&gt;    $fbconfig['secret'],'cookie' =&gt; true));       
  
  $session = $facebook-&gt;getSession();       
  $fbme = null;     
  // Session based graph API call.     
  if (!empty($session)) 
  {       
    d($session);
    try 
    {         
      $uid = $facebook-&gt;getUser();         
      $fbme = $facebook-&gt;api('/me');       
    } 
    catch (FacebookApiException $e) 
    {           
      d($e);       
    }    
  }      
  function d($d)
  {         
  echo '&lt;pre&gt;';         
  print_r($d);         
  echo '&lt;/pre&gt;';     
  } 
  
  
  if ($fbme) 
  {   
    $logoutUrl = $facebook-&gt;getLogoutUrl(); 
    echo"&lt;a href='{$logoutUrl}'&gt;logout&lt;/a&gt;";
    d($fbme);
  } 
  else 
  {   
    $loginUrl = $facebook-&gt;getLoginUrl(array('req_perms' =&gt; 'email,read_stream,user_birthday')); 
    echo"&lt;a href='{$loginUrl}'&gt;login&lt;/a&gt;";
  }
  </code></pre>
  
  <p>thanks</p>
  
  <p>Luca</p>