잉끼s

페이스북 로그인 안되시는 분들 참고해주세요.

facebook api v2.2 이 종료가 되면서    

/oauth/access_token 의 리턴값이 query_string 형태에서 json 형태 값으로 변경되었습니다.

 

/plugin/sns/facebook/src/base_facebook.php 중  

parse_str() 대신 json_decode를 이용해주시면 됩니다.  

 


  protected function getAccessTokenFromCode($code, $redirect_uri = null) {

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

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

    try {
      // need to circumvent json_decode by calling _oauthRequest
      // directly, since response isn't JSON format.
      $access_token_response =
        $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;
    }

 
    $response_params = json_decode($access_token_response, true);
    //$response_params = array();
    //parse_str($access_token_response, $response_params);

    if (!isset($response_params['access_token'])) {
      return false;
    }

    $fb_access_token_expires = strtotime(G5_TIME_YMDHIS)+$response_params['expires'];
    $this->setPersistentData('access_token_expires', $fb_access_token_expires);

    return $response_params['access_token'];
  } 

   

 

 

|

댓글 7개

@thisgun 이거 패치하셔야 될 것 같습니다. ^^
@잉끼다 네 ㅠ 그렇네요. 알려주셔서 감사합니다.
8년 전
알려주셔서 감사합니다.
알려주셔서 감사합니다!
감사합니다.
네 감사합니다.
헤매다가 이거 보고 해결 했네요 감사합니다.
댓글을 작성하시려면 로그인이 필요합니다. 로그인

자유게시판

+
제목 글쓴이 날짜 조회
8년 전 조회 2,215
8년 전 조회 1,938
8년 전 조회 1,779
8년 전 조회 1,755
8년 전 조회 1,712
8년 전 조회 1,940
8년 전 조회 1,787
8년 전 조회 3,016
8년 전 조회 1,971
8년 전 조회 1,765
8년 전 조회 2,403
8년 전 조회 1,865
8년 전 조회 1,816
8년 전 조회 1,358
8년 전 조회 1,997
8년 전 조회 1,963
8년 전 조회 1,622
8년 전 조회 1,975
8년 전 조회 2,036
8년 전 조회 1,836
8년 전 조회 1,326
8년 전 조회 1,821
8년 전 조회 1,980
8년 전 조회 1,765
8년 전 조회 2,031
8년 전 조회 2,574
8년 전 조회 2,124
8년 전 조회 2,000
8년 전 조회 1,744
8년 전 조회 1,813
🐛 버그신고