Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expired time jwt token #10

Closed
HiepNinh opened this issue Jun 1, 2018 · 2 comments
Closed

Expired time jwt token #10

HiepNinh opened this issue Jun 1, 2018 · 2 comments

Comments

@HiepNinh
Copy link

HiepNinh commented Jun 1, 2018

I've tried to set JWT token that never expired.

$token = Yii::$app->jwt->getBuilder()->setIssuer(Yii::$app->params['issuer'])// Configures the issuer (iss claim)
            ->setId(Yii::$app->params['token_id'], true)// Configures the id (jti claim), replicating as a header item
            ->setIssuedAt(time())// Configures the time that the token was issue (iat claim)
            ->setExpiration(0)// Configures the expiration time of the token (exp claim) NEVER EXPIRED
            ->set('username', $params['username'])
            ->set('password', $params['password'])// Configures a new claim, called "uid"
            ->sign($signer,Yii::$app->params['secret_key'])
            ->getToken(); // Retrieves the generated token

Although expression setExpiration() is taken 0 or omitted, $token still expired. Could anyone find anyways to solve this problem. Thanks.

@sizeg sizeg added the question label Jun 1, 2018
@sizeg sizeg self-assigned this Jun 4, 2018
@sizeg
Copy link
Owner

sizeg commented Jun 4, 2018

@HiepNinh Have you tried building a token without calling method setExpiration()?

@sizeg
Copy link
Owner

sizeg commented Jun 25, 2018

Closed for lack of update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants