@param null $token

@return mixed
@throws \Skmetaly\TwitchApi\Exceptions\RequestRequiresAuthenticationException
432049
public function videosFollowed($token = null)
    {
        $token = $this->getToken($token);

        $usersAPI = new Users($token);

        return $usersAPI->videosFollowed();
    }
554821
protected function acquireAuthenticationCookies($token)
    {
        $urlInfo = parse_url($this->authorityUrl);

        $url =  $urlInfo['scheme'] . '://' . $urlInfo['host'] . self::$SignInPageUrl;
        if ($this->usingFederatedSTS) {
            $url =  $urlInfo['scheme'] . '://' . $urlInfo['host'] . self::$IDCRLSVCPageUrl;

            $headers = array();
            $headers['User-Agent'] = '';
            $headers['X-IDCRL_ACCEPTED'] = 't';
            $headers['Authorization'] = 'BPOSIDCRL ' . $token;
            $headers['Content-Type'] = 'application/x-www-form-urlencoded';

            $response = Requests::head($url,$headers,true);
            $cookies = Requests::parseCookies($response);
            $this->SPOIDCRL = $cookies['SPOIDCRL'];
        }
        else {
            $response = Requests::post($url,null,$token,true);
            $cookies = Requests::parseCookies($response);
            $this->FedAuth = $cookies['FedAuth'];
            $this->rtFa = $cookies['rtFa'];
        }
    }
605417
public function login($token)
    {
        $subject           = SecurityUtils::getSecurityManager()->login($this, $token);
        $this->_principal  = $subject->getPrincipal();
        $this->_principals = $subject->getPrincipals();
        $this->principals = $subject->getPrincipals();

        if ($this->_principals === null || empty($this->_principals)) {
            $msg = "Principals returned from SecurityManager->login( token ) returned an empty set.".
                    "This must be populated with one or more elements.";
            throw new \Exception(msg);
        }
        $this->_authenticated = true;

    }
972372
public function authRequest($guard = null)
    {
        return is_null($guard) ? request()->user() ?? request()->user('api') : request()->user($guard);
    }
168713
public function create($token = null)
    {
        if ($token) {
            $this->model->setToken($token);
        }

        return $this->request->create($this->model);
    }
430957
public static function getToken($params = null)
    {
        if (!$params) {
            $params = array();
        }
        $requestor = new ApiRequestor(Sumup::$connectBase, true);
        $params['client_id'] = self::_getConnectParam('client_id', $params);
        $params['client_secret'] = self::_getConnectParam('client_secret', $params);
        $response = $requestor->request('post', '/token', $params);

        if ($response->raw->getStatusCode() !== 200) {
            throw new Error\AuthenticationError('Token request error');
        }

        return new AccessToken($response);
    }
487019
public function getCard(string $token)
    {
        // Lof Debug
        $this->flow->getLogger()->debug("Retrieving Card with token $token");

        $resource = $this->make(
            $this->flow->send(
                'get',
                $this->endpoint . '/getRegisterStatus',
                ['token' => $token]
            )
        );

        $resource->setExists((int)$resource->status === 1);

        return $resource;
    }
262298
public function getUploadResult($token)
    {
        $jwt = new Jwt();

        $claims = $jwt->decode($token, false);

        if (!isset($claims['scope'])) {
            throw new AuthenticationException('scope is not exists');
        }

        if ($claims['scope'] !== 'bos.object.create.response') {
            throw new AuthenticationException(['`:scope` scope is not valid', 'scope' => $claims['scope']]);
        }

        if (!isset($claims['bucket'])) {
            throw new AuthenticationException('bucket is not exists');
        }

        $bucket = $claims['bucket'];

        $this->logger->info($token, 'bosClient.getUploadResult');

        $jwt->verify($token, is_string($this->_access_key) ? $this->_access_key : $this->_access_key[$bucket]);

        return array_except($claims, ['scope', 'iat', 'exp']);
    }
538251
public static function findByPasswordResetToken(string $token) : ?self
    {
        if (!static::isPasswordResetTokenValid($token)) {
            return null;
        }
        return static::findOne([
            'password_reset_token' => $token,
            'status' => self::STATUS_ACTIVE,
        ]);
    }
681242
public function get($token)
    {
        foreach ($this->getDbConnection()->fetchAll(
            'SELECT * FROM oauth_refresh_token
            WHERE refresh_token = :token', [
                'token' => $token
            ]
        ) as $row) {
            if ($row) {
                return (new RefreshTokenEntity($this->server))
                    ->setAccessTokenId($row['access_token'])
                    ->setExpireTime($row['expire_time'])
                    ->setId($row['refresh_token']);
            }
        }
        return null;
    }
69167
public function getByRememberToken(int $id, string $token) : ?Authenticatable
    {
        $model = $this->getModel();

        $user = $model->newQuery()
                      ->where($model->getAuthIdentifierName(), $id)
                      ->first();

        if ($user === null) {
            return null;
        }

        $rememberToken = $user->getRememberToken();

        return !empty($rememberToken) && hash_equals($rememberToken, $token) ? $user : null;
    }
1306348
public function requestLookupToken($token, $requestId = '0')
    {

        $endPoint = str_replace('{token}', $token, self::ENDPOINT_LOOKUP_TOKEN);

        // Add request_id on end point url
        $endPoint .= '?request_id=' . $requestId;

        $response = $this->getClientProvider()
                         ->request(self::METHOD_LOOKUP_TOKEN, $endPoint, array(), true);

        $pctMapper = new PaymentCardTokenMapper($response->toArray());

        return $pctMapper->getModelObjectMapped();
    }
968531
private function retrieveByToken(string $token)
    {
        $token = $this->validateToken($token);
        if (!$token) {
            return NULL;
        }
        $user = new User();
        if ($token->hasClaim('sub')) {
            $user->id = $token->getClaim('sub');
        }
        if ($token->hasClaim('name')) {
            $user->name = $token->getClaim('name');
        }
        if ($token->hasClaim('email')) {
            $user->email = $token->getClaim('email');
        }
        if ($token->hasClaim('roles')) {
            $user->roles = explode(' ', $token->getClaim('roles'));
        }
        if ($token->hasClaim('registries')) {
            $user->registries = explode(' ', $token->getClaim('registries'));
        }
        if ($token->hasClaim('cpf')) {
            $user->cpf = $token->getClaim('cpf');
        }
        if ($token->hasClaim('avatar')) {
            $user->avatar = $token->getClaim('avatar');
        }

        return $user;
    }
600152
public Authentication getAuthentication(String token) {
		if (null != token) {
			TokenContainer container = tokens.get(token);
			if (null != container) {
				if (container.isValid()) {
					return container.getAuthentication();
				} else {
					logout(token);
				}
			}
		}
		return null;
	}
527658
public function retrieveByToken($identifier, $token) {
        /** @var RecordInterface|Authenticatable $userRecord */
        if (!$this->isValidIdentifierValue($identifier)) {
            return null;
        }
        $userRecord = $this->createEmptyUserRecord();
        /** @var RecordInterface $user */
        $user = $userRecord->fromDb([
            $userRecord->getAuthIdentifierName() => $identifier,
            $userRecord->getRememberTokenName() => $token,
        ], [], $this->getRelationsToFetch());

        return $this->validateUser($user, null);
    }
84476
public function get($token)
    {
        $result = $this->getConnection()->table('oauth_refresh_tokens')
                ->where('oauth_refresh_tokens.id', $token)
                ->where('oauth_refresh_tokens.expire_time', '>=', time())
                ->first();

        if (is_null($result)) {
            return;
        }

        return (new RefreshTokenEntity($this->getServer()))
               ->setId($result->id)
               ->setAccessTokenId($result->access_token_id)
               ->setExpireTime((int) $result->expire_time);
    }
1129054
protected function getUserByToken($token)
    {
        $userUrl = 'https://' . $this->shopURL . $this->adminPath . "shop.json";


        $response = $this->getHttpClient()->get( $userUrl,
                [
                    'headers' => $this->getResponseHeaders($token)
                ]);

        $user = json_decode($response->getBody(), true);

        $this->responseHeaders = $response->getHeaders();

        return $user['shop'];
    }