I needed a token that will never expire i.e it will have a lifetime validity. So, I changed the following in jwt.php
file in config
folder.
'ttl' => env('JWT_TTL', null),
But after this action I started getting erros saying: Tymon\JWTAuth\Exceptions\TokenInvalidException: JWT payload does not contain the required claims in file apiTest/vendor/tymon/jwt-auth/src/Validators/PayloadValidator.php on line 65
.
This issue is occuring because required_claims
is expecting the exp
. So just remove exp
key from your config/jwt.php's
required_claims
array like.
'required_claims' => [
'iss',
'iat',
// 'exp',
'nbf',
'sub',
'jti',
],
In my case I just commented the exp
line and this will solve the problem.
A issue was created on github regarding this issue. You can find it here. Here you will get solution to this problem and similar problems.