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

자유게시판

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

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

본문

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'];
  } 

   

 

 

추천
5

댓글 7개

전체 199,631 |RSS
자유게시판 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT