- Generate fake token with javainuse.com/jwtgenerator.
- Debug the token on JWT.io.
# Export the token for readability
export TOKEN="eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiZGJvd2xpbmciLCJleHAiOiIxNzE5NTA4OTI3IiwiZ3JvdXAiOiJkZXZlbG9wZXIifQ.sLMUZtxw-krA5hTAmKFcem-5uP7I35h6ypIfZKUEuXI"
# Use the command directly
jq -R 'split(".") | .[1] | @base64d | fromjson' <<< "$TOKEN"
# or the bash script
./jwt-decode.sh "$TOKEN"
# or the ZSH function
decode-jwt "$TOKEN"
Output:
{
"user_id": "dbowling",
"exp": "1719508927",
"group": "developer"
}Output should match the JWT.io debug.