Skip to content

kshji/jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

JWT Shell Script Encode and Decode JWT Token

JWT Token encode and decode libraries for Token Signing/Verification have listed on Jwt.io site, but not for shell scripts.

I have put examples to my jwt.sh script to handle JWT in any Posix compatible shells (ksh, bash, dash, zsh, ...)

You need openssl to run this scripts.

Also Jq command-line JSON processor helps to parse JSON elements. Ksh93 include builtin json element support, but other shell not. I used jq to make generic solution.

Syntax :

    jwt.sh [options] -e |  -d  -j jwt_access_token
            -e # encode
            -d token # decode
            -t sec          # timetolive token
            -s secretkey
            --debug 0|1

Example encode:

            jwt.sh --debug 1 -e -s "somesec"

            jwt.sh -e -s "somesec" -t 1

Example decode:

            jwt.sh --debug 1 -d -s "somesec" -j "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6IjAwMDEiLCJpc3MiOiJTaCBKV1QgR2VuZXJhdG9yIiwiZXhwIjoiMTUxNzc2NDcxNyIsImlhdCI6IjE1MTc3NjExMTcifQ.eyJJZCI6MSwiTmFtZSI6Ik15IE5hbWUifQ.Yjiif1mZfHV0V49NLE2e0LI5GY6wJ9LLk0pH1Y0"

            jwt.sh -d -s "somesec" -j "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6IjAwMDEiLCJpc3MiOiJTaCBKV1QgR2VuZXJhdG9yIiwiZXhwIjoiMTUxNzc2NDcxNyIsImlhdCI6IjE1MTc3NjExMTcifQ.eyJJZCI6MSwiTmFtZSI6Ik15IE5hbWUifQ.Yjiif1mZfHV0V49NLE2e0LI5GY6wJ9LLk0pH1Y0"

About

Jwt access token shell script encode and decode

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages