Decode JWT in Shell
Thu, Sep 1, 2022 | #shell #jwt
There are many online tools for this, but it also works locally.
jwt() {
if [ "$#" -ne 1 ] ; then
echo "Usage: jwt <token>"
else
echo -n $1 | cut -d'.' -f1 | base64 -d | jq
echo ====
echo -n $1 | cut -d'.' -f2 | base64 -d | jq
fi
}