get token information

@param string $token The token to retrieve information about
@param Zend_Http_Client $client (optional) HTTP client to use to
make the request
@param string $request_uri (optional) URI to which to direct
the information request
199607
public static function getAuthSubTokenInfo(
            $token, $client = null, $request_uri = self::AUTHSUB_TOKEN_INFO_URI)
    {
        $client = self::getHttpClient($token, $client);

        if ($client instanceof Zend_Gdata_HttpClient) {
            $filterResult = $client->filterHttpRequest('GET', $request_uri);
            $url = $filterResult['url'];
            $headers = $filterResult['headers'];
            $client->setHeaders($headers);
            $client->setUri($url);
        } else {
            $client->setUri($request_uri);
        }

        ob_start();
        try {
            $response = $client->request('GET');
        } catch (Zend_Http_Client_Exception $e) {
            ob_end_clean();
            require_once 'Zend/Gdata/App/HttpException.php';
            throw new Zend_Gdata_App_HttpException($e->getMessage(), $e);
        }
        ob_end_clean();
        return $response->getBody();
    }
466293
public function fetchRequestToken($request)
    {
        $this->getVersion($request);

        $consumer = $this->getConsumer($request);

        // no token required for the initial token request
        $token = null;

        $this->checkSignature($request, $consumer, $token);

        $new_token = $this->dataStore->newRequestToken($consumer);

        return $new_token;
    }
943133
def get_token(code, token_service, client_id, client_secret, redirect_uri,
              grant_type):
  """"""
  data = {
      'code': code,
      'client_id': client_id,
      'client_secret': client_secret,
      'redirect_uri': redirect_uri,
      'grant_type': grant_type,
  }
  # Get the default http client
  resp = requests.post(token_service, data, verify=False)
  return resp.json()
1259605
static function getToken($url, $login, $password) {
	    $responseEntity = RestHelper::post($url, [
		    'login' => $login,
		    'password' => $password,
	    ]);
	    if(!$responseEntity->is_ok) {
		    return null;
	    }
	    $token = self::getTokenFromResponse($responseEntity);
	    return $token;
    }
673547
private function acquireToken()
    {
        // Request the token
        $client = new Client(); //GuzzleHttp\Client

        try {
            $response = $client->post($this->token_endpoint, [
                'form_params' => $this->getOauthFields(),
                'curl' => $this->setOauthCurlopts(),
                'synchronous' => true,
            ]);

            // Get the token and type from the response
            $body = $this->parseTokenResponse($response);

        } catch (\GuzzleException $e) {
            return false;
        }

        return $body;
    }
802450
protected function getRequestToken(Request $request)
    {
        /** @var TokenExtractorInterface $tokenExtractor */
        foreach ($this->tokenExtractors as $tokenExtractor) {
            if (($token = $tokenExtractor->extract($request))) {
                return $token;
            }
        }
    }
901491
public function verify(Request $request, $token = null)
    {
        if (is_null($token)) {
            return $this->showVerifyMessage();
        }

        $credentials = ['email' => $request->get('email'), 'token' => $token];

        $broker = $this->getBroker();

        $response = Verification::broker($broker)->verify($credentials, function ($user) {
            $this->verifyUser($user);
        });

        switch ($response) {
            case Contracts\VerificationBroker::VERIFIED:
                return $this->getVerificationSuccessResponse($response);

            default:
                return $this->getVerificationFailureResponse($request, $response);
        }
    }
1325854
def fetch_token(self, **kwargs):
        """"""
        return super(AsanaOAuth2Session, self).fetch_token(self.token_url, client_secret=self.client_secret, **kwargs)
1083236
private function requestToken()
    {
        $tokenResponse = $this->client->request(
            'GET',
            $this->config->getAuthUrl(),
            $this->config->getAuthHeader()
        );


        $this->token = $tokenResponse->getBody()->getContents();

        $this->tokenExpireTime->modify(
            sprintf('+%s seconds', 3600)
        );
    }
800376
protected function sendByHttp(string $url, string $token = null) : void
    {
        $content = ['event' => static::NAME, 'data' => $this->data];

        $request = new Request($url, $content);
        if ($token) {
            $request->addHeader(Header::AUTHORIZATION, $token);
        }

        $request->send();
    }
595557
protected function getTokenForRequest()
	{
		$token = $this->request->input( $this->inputKey );

		if ( empty( $token ) )
			$token = $this->request->bearerToken();

		if ( empty( $token ) )
			$token = $this->request->getPassword();

		return $token;
	}
1285873
private function parseToken(Request $request) : ?Token
    {
        $cookies    = $request->getCookieParams();
        $cookieName = $this->defaultCookie->getName();

        if (! isset($cookies[$cookieName])) {
            return null;
        }

        try {
            $token = $this->tokenParser->parse($cookies[$cookieName]);
        } catch (\InvalidArgumentException $invalidToken) {
            return null;
        }

        if (! $token->validate(new ValidationData())) {
            return null;
        }

        return $token;
    }
1295664
public function get($url, $params=array(), $token='', $secret='') {
        return $this->request('GET', $url, $params, $token, $secret);
    }
1310178
private function getToken($request, $consumer, $token_type = "access")
    {
        $token_field = $request instanceof Request
            ? $request->getParameter('oauth_token')
            : null;

        $token = $this->data_store->lookupToken(
            $consumer,
            $token_type,
            $token_field
        );
        if (!$token) {
            throw new Exception("Invalid $token_type token: $token_field");
        }
        return $token;
    }
824394
private function getToken($request, $consumer, $token_type = "access")
    {
        $token_field = @$request->getParameter('oauth_token');
        $token = $this->dataStore->lookupToken(
            $consumer,
            $token_type,
            $token_field
        );
        if (!$token) {
            throw new Exception("Invalid $token_type token: $token_field");
        }
        return $token;
    }
175807
protected function getCreateChargeResponse($url, $token)
    {
        $postKey = $this->httpClientVersionCheck();

        $response = $this->getHttpClient()->post($url,
        [
            'headers'=> $this->getResponseHeaders($token),
            $postKey => $this->getOptions()
        ]);

        return json_decode($response->getBody(), true);
    }
761955
private function getToken(Client $client, $forceNew = false)
    {
        $tokenName = sprintf('keystone_token_%s', rawurlencode($client->getTokenUrl()));

        // see if token is in cache
        if (!$forceNew && $cachedToken = $this->cache->get($tokenName)) {
            $token = unserialize($cachedToken);
        }

        if (!isset($token) || !($token instanceof Token) || $this->tokenIsExpired($token)) {
            $token = $this->createToken($client);
            $this->cache->set($tokenName, serialize($token), $token->getExpirationDate()->getTimestamp() - time());
        }

        return $token;
    }