Skip to content

Instantly share code, notes, and snippets.

@Ajnasz
Created April 12, 2024 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ajnasz/fe28b3e51c39be042f040934f6d4efae to your computer and use it in GitHub Desktop.
Save Ajnasz/fe28b3e51c39be042f040934f6d4efae to your computer and use it in GitHub Desktop.
jwt decode shell script
#!/bin/sh
# Decode JWT token
# Usage: echo <jwt_token> | jwtdecode
# requires jq and base64
while read input; do
echo $input | cut -d . -f 1,2 | tr '.' '\n' | \
while read str;do
echo "$str"==== | fold -w 4 | sed '$ d' | tr -d '\n' | base64 --decode | jq
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment