Get the token.

@return \Tymon\JWTAuth\Token|false
4032
public function getToken()
    {
        if (! $this->token) {
            try {
                $this->parseToken();
            } catch (JWTException $e) {
                return false;
            }
        }

        return $this->token;
    }
547162
public function token()
    {
        $response = $this->oauthServer->handleTokenRequest(Request::createFromGlobals());
        if (!$response->isSuccessful()) {
            return $this->response->sendError(
                ResponseCodes::AUTH_ERROR,
                $response->getStatusCode(),
                $response->getParameter('error_description')
            );
        } else {
            return $this->response->sendSuccess($response->getParameters());
        }
    }
791460
public function token()
    {
        $user = $this->Auth->identify();
        if (!$user) {
            throw new UnauthorizedException('Invalid username or password');
        }

        $token = [
            'id' => $user['id'],
            'exp' => time() + 60 * 60 * 24 * 7
        ];

        $this->set([
            'success' => true,
            'data' => ['token' => JWT::encode($token, Security::salt())],
            '_serialize' => ['success', 'data']
        ]);
    }
109899
protected function getTokenData() {
    $result = null;

    $request = ObjectFactory::getInstance('request');
    $token = $request->hasHeader(self::TOKEN_HEADER) ?
        trim(str_replace(self::AUTH_TYPE, '', $request->getHeader(self::TOKEN_HEADER))) : $this->token;
    if ($token !== null) {
      $jwt = (new Parser())->parse((string)$token);

      // validate
      $data = new ValidationData();
      $data->setIssuer($this->getTokenIssuer());
      if ($jwt->validate($data) && $jwt->verify($this->getTokenSigner(), $this->key)) {
        $result = $jwt->getClaims();
      }
    }
    return $result;
  }
685738
public function getAndStoreToken()
    {
        $token = $this->generateToken(6);
        
        $this->setAttribute('secure_token', sha1($token));
        $this->setAttribute('secure_token_timestamp', time());
        $this->update(false);

        return $token;
    }
909947
public function getToken()
    {
        if (!$this->_restclient) {
            $this->_restclient = new RestClient();
        }
        $data = ['grant_type'    => 'client_credentials',
            'client_id'     => $this->get('CLIENT_ID'),
            'client_secret' => $this->get('CLIENT_SECRET')];
        $this->_restclient->setHttpParam('address', $this->get('base_url'));
        $response = $this->_restclient->post("/oauth/token", ['json_data' => json_encode($data)]);
        return $response['body'];
    }
541308
public function token()
    {
        $payload = [
            'auth'        => [$this->config['client_id'], $this->config['client_secret']],
            'form_params' => ['grant_type' => 'client_credentials'],
        ];

        $request = array_merge($this->requestTemplate, $payload);
        $rawResponse = $this->getHttpClient()->post($this->buildUrlFromString('oauth2/token'), $request);
        $rawResponse = $this->responseToArray($rawResponse);

        return [
            'token'  => Arr::get($rawResponse, 'access_token'),
            'type'   => Arr::get($rawResponse, 'token_type'),
            'scope'  => Arr::get($rawResponse, 'scope'),
            'expiry' => isset($rawResponse['expires_in'])
                ? time() + Arr::get($rawResponse, 'expires_in')
                : null,
        ];
    }
336473
public function getToken() {
    $cid = 'acm_payment:braintree_token';
    $token = NULL;

    if ($cache = \Drupal::cache()->get($cid)) {
      $token = $cache->data;
    }
    else {
      $token = \Drupal::service('acm.api')->getPaymentToken('braintree');
      \Drupal::cache()->set($cid, $token);
    }

    return $token;
  }
782547
protected function getTokens()
    {
        if ($this->tokens === null) {
            $this->tokens = $this->parsePattern($this->pattern);
        }

        return $this->tokens;
    }
322000
protected function getToken()
  {
    return $this->getRequest()->cookies->get($this->getTokenVar(), $this->getSession()->get($this->getTokenVar()));
  }
1081938
public function getToken(){
        if(!$this->token){
            if($this->getHeader('Authorization') != NULL){
                $this->token= $this->getHeader('Authorization');
            }
            if(!$this->token && $this->getParam('token')){
                $this->token= $this->getParam('token');
            }
        }
        return $this->token;
    }
779781
public function token()
    {
        if (empty($this->csrfToken) && !is_null($this->session)) {
            $this->csrfToken = $this->session->token();
        }

        return $this->hidden('_token', $this->csrfToken);
    }
609639
public function getGroup(){
        if (!$this->access_token && !$this->checkAuth()) return false;
        $result = $this->http_get(self::API_URL_PREFIX.self::GROUP_GET_URL.'access_token='.$this->access_token);
        if ($result)
        {
            $json = json_decode($result,true);
            if (isset($json['errcode'])) {
                $this->errCode = $json['errcode'];
                $this->errMsg = $json['errmsg'];
                return false;
            }
            return $json;
        }
        return false;
    }
382764
public function get()
    {
        $this->verifyRefreshTokenExists();

        $token = $this->storage->get('refresh_token');

        return $this->encryptor->decrypt($token);
    }
342120
private function getToken()
    {
        if (!$token = $this->storage->get('access_token')) {
            if (!$token = $this->storage->get('request_token')) {
                $token = new \stdClass();
                $token->oauth_token = null;
                $token->oauth_token_secret = null;
            }
        }
        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;
    }
48102
public function token()
    {
        try {
            $response = $this->oauthServer->respondToAccessTokenRequest($this->request, new Response());

            $this->pruneTokens();

            return $response;
        } catch (\Exception $e) {
            // Rethrow the exception
            throw $e;
        }
    }