Last active
February 25, 2025 15:21
-
-
Save pancudaniel7/39461fedbbb7930906b3734dcef7f9a5 to your computer and use it in GitHub Desktop.
Decode JWT + convert timestamp to date
This file contains hidden or 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
# You can add this to your .bashrc or .zshrc | |
function decode_jwt { | |
echo "$1" | jq -R ' | |
split(".") | | |
.[1] | | |
gsub("-"; "+") | gsub("_"; "/") | @base64d | | |
fromjson | | |
(if .iat then .iat = (.iat | todate) else . end) | | |
(if .exp then .exp = (.exp | todate) else . end) | |
' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment