Set the access token.

@param string $accessToken

@return void
175637
public function setAccessToken($accessToken)
    {
        $this->accessToken = $accessToken;
        $this->client->authenticate($this->accessToken);
    }
385055
public function create($token, $expireTime, $accessToken)
    {
        $this->getDbConnection()->insert('oauth_refresh_token', [
            'refresh_token' => $token,
            'access_token' => $accessToken,
            'expire_time' => $expireTime
        ]);
    }
95328
public static function signInWithAccessToken( $accesstoken )
	{
		$username = self::getUsernameFromAccessToken( $accesstoken );

		if ( is_null( $username ) ) return false;

		$ip = self::getClientIp();
		$ua = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? $_SERVER['HTTP_USER_AGENT'] : '';
		$ts = date("U");
		$cu = get_current_url( true );

		self::$api_session = array( 'username' => $username );

		self::$auth['users'][ $username ]['api_logincount'] = (int) @self::$auth['users'][ $username ]['api_logincount'] + 1;
		self::$auth['users'][ $username ]['api_lastlogin'] = array(
			'ip' => $ip,
			'ua' => $ua,
			'ts' => $ts
		);
		if ( ! is_null( $cu ) ) self::$auth['users'][ $username ]['api_lastlogin']['ur'] = $cu;
		self::save();

		return self::$auth['users'][ $username ];
	}
725699
public function withAccessToken (AccessToken $token)
    {
        $config = $this->getConfig();
        $this->configureHandlers($config['handler']);
        
        $config['wechat.accessToken'] = $token;
        $config['wechat.developerMode'] = $this->developerMode;
        
        return new static($config);
    }
236791
public StoredCredential setAccessToken(String accessToken) {
    lock.lock();
    try {
      this.accessToken = accessToken;
    } finally {
      lock.unlock();
    }
    return this;
  }
1018123
public function setAccessToken($token = NULL, $expire = 0) {
    if (!empty($expire)) {
      $expire = REQUEST_TIME + $expire;
    }

    if (isset(\Drupal::request()->cookies)) {
      \Drupal::request()->cookies->set('Drupal_visitor_' . $this->accessTokenCookie, $token);
    }

    setrawcookie('Drupal.visitor.' . $this->accessTokenCookie, rawurlencode($token), $expire, '/');
  }
531508
public function setAuthToken($tenantKey, $authToken, $authTokenExpiration)
    {
        if ($this->tenantTokens[$tenantKey] == null) {
            $this->tenantTokens[$tenantKey] = array();
        }
        $this->tenantTokens[$tenantKey]['authToken'] = $authToken;
        $this->tenantTokens[$tenantKey]['authTokenExpiration'] = $authTokenExpiration;
    }
160033
public static function create($accessToken = '')
    {
        $client = ClientFactory::create();
        $responseTransformer = new ArrayBodyTransformer();
        $apiExceptionTransformer = new GuzzleTransformer();

        return new Api($client, $responseTransformer, $apiExceptionTransformer, $accessToken);
    }
1239577
public function set($key, $value)
    {
        parent::set($key, $value);

        if ($key == "ACCESS_TOKEN") { 
            $user = $this->getUserId($value);
            parent::set('USER_ID', $user['id']);
        }
        
        if (parent::get('CLIENT_ID') != "" && parent::get('CLIENT_SECRET') != "" && empty(parent::get('ACCESS_TOKEN'))) {
            
            $response = $this->getToken();

            if (isset($response['access_token'])) {
                parent::set('ACCESS_TOKEN', $response['access_token']);
            

                $user = $this->getUserId($response['access_token']);

                if (isset($user['id'])) {
                    parent::set('USER_ID', $user['id']);
                }

            }
            
        }
    }
88779
public function setAccessToken(array $accessToken)
    {
        if (!isset($accessToken['access_token'])) {
            throw new InvalidParamException('The wechat access_token must be set.');
        } elseif(!isset($accessToken['expire'])) {
            throw new InvalidParamException('Wechat access_token expire time must be set.');
        }
        $this->_accessToken = $accessToken;
    }
93175
public function setAccessToken($access_token)
    {
        $this->access_token = $access_token;
        $config = SiteConfig::current_site_config();
        $config->HailAccessToken = $access_token;
        $config->write();
    }
366930
public function storeAccessToken($userId, AccessToken $accessToken)
    {
        self::requireSession();
        $_SESSION[\sprintf('_oauth2_token_%s', $userId)][] = $accessToken;
    }
314377
public function setToken($value)
	{
		if (\is_array($value) && !array_key_exists('expires_in', $value) && array_key_exists('expires', $value))
		{
			$value['expires_in'] = $value['expires'];
			unset($value['expires']);
		}

		$this->setOption('accesstoken', $value);

		return $this;
	}
132183
public function setDefaultAccessToken($token)
    {
        if (is_string($token)) {
            $this->accessToken = new AccessToken(json_decode($token, true));
        } elseif ($token instanceof AccessToken) {
            $this->accessToken = $token;
        } else {
            throw new \Exception("Incorrect access token");
        }
        if ($this->accessToken->hasExpired()) {
            $this->refreshToken();
        }
        return $this->accessToken;
    }
1078811
public function setAccess($keyType = null, $accessMask = 0)
    {
        $this->keyType = in_array(
            ucfirst(strtolower($keyType)),
            array('Account', 'Character', 'Corporation')
        ) ? $keyType : null;
        $this->accessMask = (int)$accessMask;
    }
1208822
public function store ($hash, AccessToken $accessToken)
    {
        $colHash = $this->columns['hash'];
        $colExpires = $this->columns['expires'];
        $colToken = $this->columns['token'];

        $sql = "REPLACE INTO `{$this->table}` ( `{$colHash}`, `{$colToken}`, `{$colExpires}` ) VALUES ( ?, ?, ? )";
        $st = $this->pdo->prepare($sql);
        $st->execute([hex2bin($hash), (string)$accessToken, $accessToken->expires()->getTimestamp()]);
    }
560443
protected function saveToken(AccessToken $token)
    {
        if ($this->config['api_token'] && $this->config['api_token_type'] === 'access') {
            return;
        }
        foreach ($token->jsonSerialize() as $name => $value) {
            if (isset($this->storageKeys[$name])) {
                $this->session->set($this->storageKeys[$name], $value);
            }
        }
        $this->session->save();
    }