How can I check on the client side if my Token is expired?
In this short example in PHP the
exp
header of the token would be read and checked if its expiration date has passed.$token = 'PLACE_YOUR_JWT_HERE'; $tokenPayload = json_decode(base64_decode(explode('.', $token)[1]), true); if ($tokenPayload['exp'] < time()) { throw new RuntimeException("Token \"{$tokenPayload['sub']}\" is expired!"); }
API
JWT
eSagu API