Created
March 11, 2022 07:19
-
-
Save akkerman/7ee509df1d5ed3248c613a667f7346bb to your computer and use it in GitHub Desktop.
Decode a Json Web Token and add dates that a human understands.
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
#!/usr/bin/env node | |
const jwt = require('jsonwebtoken') | |
const token = jwt.decode(process.argv[2]) | |
const output = { | |
token, | |
issued: new Date(1000*token.iat).toLocaleString(), | |
expires: new Date(1000*token.exp).toLocaleString(), | |
} | |
console.log(JSON.stringify(output, null, 2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment