Last active
November 2, 2019 08:13
-
-
Save aarongeorge/bca875a0fc622f2eb8cd149590ad7c76 to your computer and use it in GitHub Desktop.
Example of a JWT Payload with all Registered Claims
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const timeNow = new Date() | |
const payload = { | |
iss: 'http://backend.com', // Issuer - Identifier of who provided this JWT | |
sub: 'uniqueIdOfUser', // Subject - Who is supposed to be using this JWT (The value should mean something for `aud`) | |
aud: ['http://frontend.com', 'http://backend.com'], // Audience - Who should be consuming this JWT | |
exp: new Date(new Date(timeNow).setDate(timeNow.getDate() + 7).getTime(), // Expiration Time - When this JWT should no longer be accepted by the `aud` | |
nbf: timeNow.getTime(), // Not Before - When this JWT should start being accepted by the `aud` | |
iat: timeNow.getTime(), // Issued At - When this JWT was issued | |
jti: 'uniqueIdForThisJWT' // JWT ID - Unique ID that the `aud` can use to blacklist/whitelist the JWT even if `exp` and `nbf` requirements are met | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment