2017-04-04 5 views
-1

PHP SDK 3.2.2を使用していますので、私のサーバに新しいPHPバージョンがないので4.0.0ブランチに変更できません。 FB APIを使用するすべてのアプリケーションは、不定期にリダイレクトを開始し、機能しません。エラーも通知もありません。 Facebookは、このバージョンのPHP SDKのApp Dashboardや開発者ブログには何の変化も報告していません。私はFacebook PHP SDK 3.2.2を使用しています。今から数週間リダイレクトします

私のアプリはもう一度正しく動作しますか?

答えて

0

オープンbase_facebook.phpと、このフォームにこの機能を変更します。

protected function getAccessTokenFromCode($code, $redirect_uri = null) { 
    if (empty($code)) { 
     return false; 
    } 

    if ($redirect_uri === null) { 
     $redirect_uri = $this->getCurrentUrl(); 
    } 

    try { 

     $access_token_response = json_decode(
     $this->_oauthRequest(
      $this->getUrl('graph', '/oauth/access_token'), 
      $params = array('client_id' => $this->getAppId(), 
          'client_secret' => $this->getAppSecret(), 
          'redirect_uri' => $redirect_uri, 
          'code' => $code))); 
    } catch (FacebookApiException $e) { 
     // most likely that user very recently revoked authorization. 
     // In any event, we don't have an access token, so say so. 

     return false; 
    } 

    if (empty($access_token_response)) { 
     return false; 
    } 

    if (!isset($access_token_response->access_token)) { 
     return false; 
    } 



    return $access_token_response->access_token; 
    } 

の$ access_token_responseはもはやシリアル化された配列が、JSONです。 JSONを解析し、そこからaccess_tokenを戻す必要があります。

関連する問題