Json Web Token
Sturcture
A token contains 3 parts
- Header
- Payload
- Verify Signature
Parse Payload
To parse the payload without verifying with a library, just split and take the second part. The payload is in base64, just decode it.
Here is an nodejs example
The payload of a JWT can contain serveral non-mandatory fields such as iat
and exp
.
Here are 2 of the properties that's most likely existent.
iat
means issued atexp
means expiration time
Both of them are integers in seconds from Jan 1, 1970 00:00am.
In JavaScript, to convert the 2 values to Date
Check if expired in JavaScript
Revoke JWT Token
Related Readings
Reference
How is this guide?