Skip to content

Instantly share code, notes, and snippets.

@Elektordi
Last active July 31, 2023 13:51
Show Gist options
  • Save Elektordi/6aa5f423586c4dd0d0b744a3433da127 to your computer and use it in GitHub Desktop.
Save Elektordi/6aa5f423586c4dd0d0b744a3433da127 to your computer and use it in GitHub Desktop.
Decode jwt from command line
#!/bin/sh
token="$1"
if [ -z "$token" ]; then
read token
fi
echo $token | jq -R 'gsub("-";"+") | gsub("_";"/") | split(".") | select(length > 0) | .[0],.[1] | @base64d | fromjson'
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment