Is it possible?
You can get the "payload" of a token by _decoding_ it:
$payload = JWTAuth::decode($token);
The expiration time is stored in the payload's exp "claim" (which is just a key=>value pair). This can be retrieved in multiple ways:
$expiration = $payload->getExp();
$expiration = $payload->get('exp');
$expiration = $payload['exp'];
In the default setup, the exp will simply be a UTC timestamp.
@HtmHell
$payload = JWTAuth::parseToken()->getPayload();
$expires_at = date('d M Y h:i', $payload->get('exp'));
Thanks alot!
you're welcome @HtmHell :)
Just wondering if there is any way of doing it on client side? I am currently sending and 2 extra fields to browser. expiration time for token, and expiration time for refresh.
Most helpful comment
@HtmHell