Pulls the "Me" content from Facebook

@param string $access_token The facebook connect access token

@return mixed
@endpoint ignore
339687
public function getFBInfo($access_token) {
    // If there is mock data for testing purposes, return this instead of contacting facebook
    if (!empty($this->mockData)) {
      return $this->mockData;
    }

    // todo: see if call was erroneous and throw exceptions
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://graph.facebook.com/me?access_token=' . $access_token);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);

    // Get the response and close the channel.
    $response = curl_exec($ch);
    curl_close($ch);
    return json_decode($response);
  }
23427
protected function getUserByToken(AccessTokenInterface $token)
    {
        $url = $this->baseUrl.'/oauth2.0/me?access_token='.$token->getToken();
        $this->withUnionId && $url .= '&unionid=1';

        $response = $this->getHttpClient()->get($url);

        $me = json_decode($this->removeCallback($response->getBody()->getContents()), true);
        $this->openId = $me['openid'];
        $this->unionId = isset($me['unionid']) ? $me['unionid'] : '';

        $queries = [
            'access_token' => $token->getToken(),
            'openid' => $this->openId,
            'oauth_consumer_key' => $this->clientId,
        ];

        $response = $this->getHttpClient()->get($this->baseUrl.'/user/get_user_info?'.http_build_query($queries));

        return json_decode($this->removeCallback($response->getBody()->getContents()), true);
    }
1272808
public function post(string $method, string $access_token, array $params = array()) {
        $params = $this->formatParams($params);
        $params[static::PARAM_ACCESS_TOKEN] = $access_token;

        if (!isset($params[static::PARAM_VERSION])) {
            $params[static::PARAM_VERSION] = $this->version;
        }

        if ($this->language && !isset($params[static::PARAM_LANG])) {
            $params[static::PARAM_LANG] = $this->language;
        }

        $url = $this->host . '/' . $method;

        try {
            $response = $this->http_client->post($url, $params);
        } catch (TransportRequestException $e) {
            throw new VKClientException($e);
        }

        return $this->parseResponse($response);
    }
608248
public static function fetch( $accessToken, $authCheck = true )
    {
        $tokenInfo = null;
        $session = ezcPersistentSessionInstance::get();
        $q = $session->createFindQuery( __CLASS__ );
        $e = $q->expr;

        $q->innerJoin( 'ezprest_clients', 'ezprest_token.client_id', 'ezprest_clients.client_id' );
        if ( $authCheck )
        {
            $q->innerJoin( 'ezprest_authorized_clients', $e->lAnd( $e->eq( 'ezprest_authorized_clients.rest_client_id', 'ezprest_clients.id' ),
                                                                   $e->eq( 'ezprest_authorized_clients.user_id', 'ezprest_token.user_id' ) ) );
        }

        $q->where( $q->expr->eq( 'ezprest_token.id', $q->bindValue( $accessToken ) ) );
        $tokenInfo = $session->find( $q, 'ezpRestToken' );
        if ( !empty( $tokenInfo ) )
        {
            $tokenInfo = array_shift( $tokenInfo );
        }
        else // Empty array. For consistency in result, cast it to null
        {
            $tokenInfo = null;
        }

        return $tokenInfo;
    }
373128
public static function info($access_token)
    {
        $opts = array('http' => array(
            'method'  => 'GET'
        ));

        $url = self::$clef_base_url."info?access_token=".$access_token;

        // exchange the oauth token for the user's info
        $context  = stream_context_create($opts);
        $response = file_get_contents($url, false, $context);

        if (!$response) {
            $response = json_decode($response, true);

            return $response;
        }

        return false;
    }
1091602
public function requestUserData($type = 'private', $access_token = null)
    {
        $config = $this->getConfig();
        $access_token = ($access_token) ? $access_token : $this->getAccessToken();
        $url = null;

        switch ($type) {
            case 'public':
                //error if no profile set
                if (!$this->getPublicProfileUrl()) {
                    throw new \Exception('please set the public profile you want to pull');
                }

                $url = $config['urls']['public']
                    . urlencode(urldecode($this->getPublicProfileUrl()))  // make sure the url is encoded; avoid double encoding
                    . $config['dataset'][$type]['fields'];
                break;
            case 'private':
            case 'login':
            default:
                $url = $config['urls']['private']
                    . $config['dataset'][$type]['fields'];
                break;
        }

        //add access token to request url
        $url .= '?' . http_build_query(array('oauth2_access_token' => $access_token, 'secure-urls' => 'true'));

        //send it
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_VERBOSE, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);  // don't worry about bad ssl certs
        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept-Language: en-US, ja"));
        $response = curl_exec($ch);

        $data = simplexml_load_string($response);

        return $data;
    }
1143037
def extract(group_id, access_token, fields=None):
    '''
    

    '''
    fields = fields or ['id', 'owner', 'email', 'name', 'members']
    # TEST that fields are a subset of valid fields
    assert set(fields).issubset(VALID_FIELDS)

    get_args = {'fields': ','.join(fields),
                'access_token': access_token}
    get_args_str = '&'.join(
        ['{}={}'.format(x, y) for x, y in get_args.items()])

    base_url = 'https://graph.facebook.com/{}/?{}'.format(
        group_id, get_args_str)
    logr.debug(' LOADING URL: {}'.format(base_url))

    response = rq.get(base_url)

    # FIXME: check for errors
    # probably want to validate here somehow...?
    r_json = response.json()
    subscribers = r_json.get('members')

    return subscribers
1033864
function getAccessToken($args = array()) {/*{{{*/
    $r = $this->oAuthRequest($this->accessTokenURL(), $args);
    //var_dump($r);
    $token = $this->oAuthParseResponse($r);
    $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
    return $token;
  }
232516
public function getAccessToken($access_token)
    {
        $token = $this->getObjectByType('access_token_table',$access_token);

        return is_null($token) ? false : $token;
    }
1343019
public function updateAccessToken($access_token)
    {
        $this->getEventDispatcher()->addListener('request.before_send', function(Event $event) use($access_token){
            $request = $event['request'];
            $request->setHeader('Authorization ','Bearer '. $access_token);
        });
    }
647675
function getAccessToken($oauth_verifier = FALSE)
    {
        $parameters = [];
        if (!empty($oauth_verifier)) {
            $parameters['oauth_verifier'] = $oauth_verifier;
        }
        $request = $this->oAuthRequest($this->accessTokenURL(), 'GET', $parameters);
        $token = OAuthUtil::parse_parameters($request);
        $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
        return $token;
    }
673817
public function vaildAccessToken(string $access_token, string $open_id)
    {
        $data = [
            'access_token' => $access_token,
            'openid' => $open_id,
        ];
        $url = self::WECHAT.'auth?'.http_build_query($data);
        $data = $this->curl->get($url);

        return Response::json($data);
    }
389394
public function getResourceOwner(AccessToken $token)
    {
        $this->openId = $this->getOpenId($token);

        return parent::getResourceOwner($token);
    }
230784
public function getAccessToken($access_token)
	{
		// create access token
		$token = \Components\Developer\Models\Accesstoken::oneByToken($access_token);

		// make sure we have a token
		if (!$token->get('id'))
		{
			return false;
		}

		// make sure its a published token
		if (!$token->isPublished())
		{
			return false;
		}

		// get the application's client id
		$application = \Components\Developer\Models\Application::oneOrFail($token->get('application_id'));
		$token->set('client_id', $application->get('client_id'));

		// format expires to unix timestamp
		$token->set('expires', with(new Date($token->get('expires')))->toUnix());

		// return token
		return $token->toArray(true);
	}
1158560
public function getResourceOwnerDetailsUrl(AccessToken $token)
    {
        return $this->domain.'/user/get_user_info?access_token=' . (string)$token . '&openid=' . $this->openId . '&oauth_consumer_key=' . $this->clientId;
    }
821880
public function setAuth($client_token, $client_secret, $access_token)
    {
        $this->auth = array(
            'client_token' => trim($client_token),
            'client_secret' => trim($client_secret),
            'access_token' => trim($access_token),
        );
        return $this;
    }
74790
public static function setAccessToken($access_token){
      if (!isset(self::$_config)){
        self::initialize();
      }
      self::$_config->configure(['ACCESS_TOKEN' => $access_token]);
      
    }