Extend the expiration of a token.

@param string $token
@param null   $hours
975264
public function extendByToken($token, $hours = null)
    {
        $token = $this->findByToken($token);

        if (! is_null($token)) {
            return $token->extend($hours);
        }
    }
264990
function(){
    // Don't bother if there's no expires token
    if (typeof(service.token.expires_at) === 'undefined' || service.token.expires_at === null) {
      return;
    }
    cancelExpiresAtEvent();
    var time = (new Date(service.token.expires_at))-(new Date());
    if(time && time > 0 && time <= 2147483647){
      expiresAtEvent = $interval(function(){
        $rootScope.$broadcast('oauth:expired', service.token);
      }, time, 1);
    }
  }
658723
public function setCacheTTL($hours)
    {
        if (GenericValidator::validateExpirationTime($hours)) {
            $this->cacheTTL = $hours;
            return true;
        }
        return false;
    }
1123262
public function setToken($token) {
    // check passed data
    if(!is_null($token) && !is_array($token)) {
      // bad data passed
      throw new LinkedInException('LinkedIn->setToken(): bad data passed, $token_access should be in array format.');
    }
    
    // set token
    $this->token = $token;
	}
783431
public function expireUserToken($hash)
    {
        $query = $this->handler->createUpdateQuery();
        $query
            ->update($this->handler->quoteTable('ezuser_accountkey'))
            ->set(
                $this->handler->quoteColumn('time'),
                $query->bindValue(0)
            )->where(
                $query->expr->eq(
                    $this->handler->quoteColumn('hash_key'),
                    $query->bindValue($hash, null, \PDO::PARAM_STR)
                )
            );
        $query->prepare()->execute();
    }
562642
public function setAccessToken($token)
    {
        if (!$this->oauthResponse instanceof InstagramOAuth) {
            $this->oauthResponse = new InstagramOAuth(json_decode(json_encode(['access_token' => $token])));
        }
    }
918375
public void update(Connection conn, Token token) throws SQLException {
        run.update(conn
                   , "UPDATE tokens set expiration_ts=? WHERE id=?"
                   , token.getExpiration_ts()
                   , token.getId());
    }
1009054
public function setToken($token, $expires = 7200)
    {
        Yii::$app->wechat->cache->set([__CLASS__, 'appId' => Yii::$app->wechat->appId], $token, $expires - 1500);
        return $this;
    }
750676
public function expireByToken($token)
    {
        $token = $this->findByToken($token);

        if (! is_null($token)) {
            return $token->expire();
        }
    }
51264
public function updateToken($token)
    {
        // Update Payload.
        $this->payLoad = [
            'token'      => $token,
            'expires_in' => 3600,
            'created'    => Carbon::now()->format('U'),
        ];

        // Save token.
        return $this->save();
    }
1322037
protected static function pushToken(&$context, $token) {
        if ($token === '') {
            return;
        }
        if (is_string($token)) {
            if (is_string(end($context['parsed'][0]))) {
                $context['parsed'][0][key($context['parsed'][0])] .= $token;
                return;
            }
        }
        $context['parsed'][0][] = $token;
    }
323664
public static function isPasswordResetTokenValid(int $expired, string $token = null): bool
    {
        if ($token === null) {
            return false;
        }
        $parts = explode('_', $token);
        $timestamp = (int)end($parts);
        return $timestamp + $expired >= time();
    }
385055
public function create($token, $expireTime, $accessToken)
    {
        $this->getDbConnection()->insert('oauth_refresh_token', [
            'refresh_token' => $token,
            'access_token' => $accessToken,
            'expire_time' => $expireTime
        ]);
    }
799046
public function setTokenAttribute(Token $token)
    {
        $value = null;

        if (! $token->isValid()) {
            $value = $token->toJson();
        }

        $this->attributes['token'] = $value;
    }
708254
public function checkToken($token)
    {
        return (bool) $this->token()->where('token', $token)->where('expiration_date', '>', Carbon::now())->count();
    }
233151
public function setAccessToken($token)
    {
        if (is_string($token)) {
            $token = new Token($token);
        }
        Requestor::setToken($token);
    }
85703
public function setRefreshToken($token, $clientId, $userId, $expiryTimestamp, $scope = null)
    {
        $refreshTokenDataMapper = $this->getTokenDataMapper(Entity\RefreshToken::class);

        $client = $this->getClientDataMapper()->findByUuid($clientId);

        if (! $refreshToken = $refreshTokenDataMapper->findByToken($token)) {
            $refreshToken = new Entity\RefreshToken(null, $token, $client);
        } else {
            $refreshToken->setClient($client);
        }

        if ($userId) {
            $user = $this->getUserDataMapper()->findByUuid($userId);
            if ($user instanceof $this->userClass) {
                $refreshToken->setUser($user);
            }
        }

        $expiryDate = is_int($expiryTimestamp) ? new DateTime('@' . $expiryTimestamp) : null;
        $refreshToken->setExpiryDate($expiryDate);

        if ($scope) {
            $scopes = $this->getScopeDataMapper()->findScopes(explode(' ', $scope));
            $refreshToken->setScopes($scopes);
        }

        $refreshTokenDataMapper->save($refreshToken);
    }