Laravel 5.5 Jwt Tymon套餐 php 7.1
我想知道是否可以在不刷新令牌的情况下扩展令牌的ttl。我想在midlewhere中添加现有令牌的时间。我确实设法更改了值,但此令牌上的ttl保持不变。
public function handle($request, Closure $next)
{
$response = $next($request);
$token = JWTAuth::getToken();
$claims = JWTAuth::getPayLoad()->toArray();
$claims['exp'] = strtotime('+1 day', $claims['exp']);
$payload = JWTFactory::make($claims);
$token = JWTAuth::encode($payload);
$response->headers->set('token',$token);
return $response;
}