HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

jwt — Work with JSON Web Tokens (JWTs). Encryption algorithms available are HS256, HS384, HS512, RS256, RS

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandtokensclijsonwithjwtwebwork

Problem

How to use the jwt command: Work with JSON Web Tokens (JWTs). Encryption algorithms available are HS256, HS384, HS512, RS256, RS384, RS512, ES256, ES384. More information: <https://github.com/mike-engel/jwt-cli>.

Solution

jwt — Work with JSON Web Tokens (JWTs). Encryption algorithms available are HS256, HS384, HS512, RS256, RS384, RS512, ES256, ES384. More information: <https://github.com/mike-engel/jwt-cli>.

Decode a JWT:
jwt decode {{jwt_string}}


Decode a JWT as a JSON string:
jwt decode {{[-j|--json]}} {{jwt_string}}


Encode a JSON string to a JWT:
jwt encode {{[-A|--alg]}} {{HS256}} {{[-S|--secret]}} {{1234567890}} '{{json_string}}'


Encode key pair payload to JWT:
jwt encode {{[-A|--alg]}} {{HS256}} {{[-S|--secret]}} {{1234567890}} {{[-P|--payload]}} {{key=value}}

Code Snippets

Decode a JWT

jwt decode {{jwt_string}}

Decode a JWT as a JSON string

jwt decode {{[-j|--json]}} {{jwt_string}}

Encode a JSON string to a JWT

jwt encode {{[-A|--alg]}} {{HS256}} {{[-S|--secret]}} {{1234567890}} '{{json_string}}'

Encode key pair payload to JWT

jwt encode {{[-A|--alg]}} {{HS256}} {{[-S|--secret]}} {{1234567890}} {{[-P|--payload]}} {{key=value}}

Context

tldr-pages: common/jwt

Revisions (0)

No revisions yet.