Sets the Access token credentials and re-initialises the request client.

@param $token
@param $tokenSecret
501826
public function setAccessTokenCredentials($token, $tokenSecret)
    {
        $this->credentials->setToken($token);
        $this->credentials->setTokenSecret($tokenSecret);
        $this->initOauthRequestClient();
    }
825035
public function setToken(string $token, int $lifetime = 7200): AccessTokenInterface
    {
        $this->getCache()->set($this->getCacheKey(), [
            $this->tokenKey => $token,
            'expires_in' => $lifetime,
        ], $lifetime - $this->safeSeconds);

        if (!$this->getCache()->has($this->getCacheKey())) {
            throw new RuntimeException('Failed to cache access token.');
        }

        return $this;
    }
457718
public function authenticate($username, $token) {
        if (empty($username) || empty($token)) {
            throw new \ErrorException('No username or token supplied.');
        }
        
        $this->username = $username;
        $this->token = $token;
    }
847439
private function setUpCredentials($credentials)
    {
        if (is_array($credentials)) {
            // using full credentials
            $this->clientId = $credentials['client-id'];
            $this->clientSecret = $credentials['client-secret'];
            $this->redirectUrl = $credentials['redirect-url'];
            $this->state = $credentials['state'];
            $this->scopes = $credentials['scopes'];
        } else {
            // using self issued access token
            $this->accessToken = $credentials;
        }
    }
842782
public static function setSSLAuth($sslCert = null, $sslKey = null, $sslCACert = null)
	{
		self::$sslCert = $sslCert;
		self::$sslKey = $sslKey;
		self::$sslCACert = $sslCACert;
	}
542521
protected function doAuth($provider, TokenInterface $token)
    {
        if (! $provider instanceof ApiKeyUserProviderInterface) {
            return false;
        }

        /** @var UserInterface $user */
        $user = $provider->loadUserByApiKey($token->getCredentials());

        if ($user) {
            $authenticatedToken = new ApiKeyUserToken($user->getRoles());
            $authenticatedToken->setUser($user);

            return $authenticatedToken;
        }

        throw new AuthenticationException("The API Key authentication failed.");
    }
24387
public function authenticate(string $method, string $token, string $password = null)
    {
        $this->getHttpClientBuilder()->removePlugin(Authentication::class);
        $this->getHttpClientBuilder()->addPlugin(new Authentication($method, $token, $password));
    }
1230536
private function authenticateUser($token)
    {
        $this->imgur->setAccessToken($token);
        // Refresh the token if neccessary
        if($this->imgur->checkAccessTokenExpired())
        {
            $this->imgur->refreshToken();
        }
    }
75473
public function refreshCreateAccessTokenResponse(
        ClientInterface $client,
        \Limoncello\OAuthServer\Contracts\TokenInterface $token,
        bool $isScopeModified,
        array $scope = null,
        array $extraParameters = []
    ): ResponseInterface {
        $this->logDebug('Prepare refresh token.');

        /** @var TokenInterface $token */
        assert($token instanceof TokenInterface);

        $updatedToken   = clone $token;
        $tokenExpiresIn = $this->getIntegration()->isRenewRefreshValue() === false ?
            $this->setUpTokenValue($updatedToken) : $this->setUpTokenValues($updatedToken);

        $tokenRepo = $this->getIntegration()->getTokenRepository();
        if ($isScopeModified === false) {
            $tokenRepo->updateValues($updatedToken);
        } else {
            assert(is_array($scope));
            $tokenRepo->inTransaction(function () use ($tokenRepo, $updatedToken, $scope) {
                $tokenRepo->updateValues($updatedToken);
                $tokenRepo->unbindScopes($updatedToken->getIdentifier());
                $tokenRepo->bindScopeIdentifiers($updatedToken->getIdentifier(), $scope);
            });
            $updatedToken->setScopeModified()->setScopeIdentifiers($scope);
        }
        $response = $this->createBodyTokenResponse($updatedToken, $tokenExpiresIn);

        return $response;
    }
1035891
public function setAuthnContextDecl(Chunk $authnContextDecl) : void
    {
        if (!empty($this->authnContextDeclRef)) {
            throw new \Exception(
                'AuthnContextDeclRef is already registered! May only have either a Decl or a DeclRef, not both!'
            );
        }

        $this->authnContextDecl = $authnContextDecl;
    }
562642
public function setAccessToken($token)
    {
        if (!$this->oauthResponse instanceof InstagramOAuth) {
            $this->oauthResponse = new InstagramOAuth(json_decode(json_encode(['access_token' => $token])));
        }
    }
148249
public void setCredentials(final String userId, final String apiToken, final String apiSecret) {
        if (userId != null && apiToken != null && apiSecret != null) {
            this.usersUri = String.format(BandwidthConstants.USERS_URI_PATH, userId.replaceAll(" ", ""));
            this.token = apiToken.replaceAll(" ", "");
            this.secret = apiSecret.replaceAll(" ", "");

            validateCredentials();
        } else {
            throw new MissingCredentialsException();
        }
    }
327551
public function verify(Token $token, VerificationContext $verificationContext = null): void
    {
        if (null === $verificationContext) {
            $verificationContext = new VerificationContext($this->getEncryption());
        }

        if ($this->getAudience()) {
            $verificationContext->setAudience($this->getAudience());
        }

        try {
            $this->getLib()->verify($token, $verificationContext);
        } catch (\Exception $exception) {
            throw new VerifyTokenException('Token did not pass the verification', $exception->getCode(), $exception);
        }
    }
975222
public function new_access_token($token, $consumer, $verifier = null)
	{
		\common_Logger::d(__CLASS__.'::'.__FUNCTION__.' called');
		return null;
	}
1161534
protected function setCredentials($memcached, $credentials)
    {
        list($username, $password) = $credentials;

        $memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, true);

        $memcached->setSaslAuthData($username, $password);
    }
395193
public function refreshToken($clientId, $clientSecret, $refreshToken): Token
    {
        $request = new Request('POST', $this->tokenUrl, [
            'Content-Type' => 'application/json',
        ], json_encode([
            'client_id' => $clientId,
            'client_secret' => $clientSecret,
            'refresh_token' => $refreshToken,
            'grant_type' => 'refresh_token',
        ]));

        $response = $this->getClient()->sendRequest($request);
        $responseBody = $response->getBody()->getContents();

        $this->token = $this->denormalizeObject(Token::class, [json_decode($responseBody)], false);

        return $this->token;
    }
39434
public function setAccessToken($token)
    {
        /**
         * @var Client $google
         */
        $google = Container::getInstance()->make(Client::class);

        $google->getCache()->clear();

        $google->setAccessToken($token);

        if (isset($token['refresh_token']) and $google->isAccessTokenExpired()) {
            $google->fetchAccessTokenWithRefreshToken();
        }

        return $this->setService($google->make('sheets'))
                    ->setDriveService($google->make('drive'));
    }