Exemple #1
0
 /**
  * Analyzes the supplied result to see if it was thrown
  * because the access token is no longer valid.  If that is
  * the case, then we destroy the session.
  *
  * @param $result array A record storing the error message returned by a failed API call.
  * @throws Facebook\FacebookApiException
  */
 protected function resolveAPIException($result)
 {
     $e = new Facebook\FacebookApiException($result);
     switch ($e->getType()) {
         case 'OAuthException':
             // OAuth 2.0 Draft 00 style
         // OAuth 2.0 Draft 00 style
         case 'invalid_token':
             // OAuth 2.0 Draft 10 style
         // OAuth 2.0 Draft 10 style
         case 'Exception':
             // REST server errors are just Exceptions
             if ($this->apiErrorRequiresSessionDestroy($e->getMessage())) {
                 $this->fb->destroySession();
             }
             break;
     }
     return $e;
 }
 /**
  * Synchronize user state with facebook.
  */
 public function syncFacebookSession()
 {
     if ($this->facebook->getUser() && $this->isUserChangeState()) {
         $this->facebook->destroySession();
     }
 }