/jwt-generator-docker

A simple command-line utility to encode JSON Web Tokens (JWT).

Primary LanguageShellThe UnlicenseUnlicense

jwt-generator

A simple command-line utility to encode JSON Web Tokens (JWT).

Usage

The Docker container takes two parameters:

  • the secret used for signing the token
  • the JSON payload

The JSON payload can be provided as an argument:

docker run --rm orrc/jwt-generator my-shared-secret '{"foo": "bar", "num": 1234}'

Or it can be piped in:

echo '{"foo": "bar", "num": 1234}' | docker run --rm -i orrc/jwt-generator my-shared-secret

The JWT is printed to stdout, followed by a newline.

Credits

This is just a convenient wrapper around a handy Bash script created by @williamhaley, including some shell magic by Filipe Fortes.