Skip to content

Latest commit

 

History

History
47 lines (35 loc) · 960 Bytes

README.md

File metadata and controls

47 lines (35 loc) · 960 Bytes

jwt

A simple debugger for jwt tokens written in Go.

Installation

go install github.com/romeovs/jwt@latest

Usage

To decode a JWT, just pass it as an argument:

jwt decode "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"

You can also pipe the token into jwt, like so:

echo "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" | jwt decode

or pass a file as the argument:

jwt decode ./file

Example output

The output looks like this:

      Type  JWT
 Algorithm  HS256
   Subject  1234567890

    Issued  2018-01-18 02:30:22 +0100 CET
   Expires  <nil>
     Valid  token is valid

{
  "iat": 1516239022,
  "name": "John Doe",
  "sub": "1234567890"
}