-
Notifications
You must be signed in to change notification settings - Fork 1
Encode JWT
Vali (naser) Rafinia edited this page Mar 27, 2023
·
3 revisions
The jwt
sub-command of the encode
command of nHash generates a human-readable output by decoding a JWT token. This sub-command is useful for decoding and inspecting JWT tokens to ensure they comply with GDPR rules.
To use the jwt
sub-command, run the following command in the terminal:
nhash encode jwt <token> [options]
Where <token>
is the JWT token you want to decode.
-
--no-summary
: If this flag is provided, the decoded information will not be displayed in a human-readable format. -
-o, --output <output>
: This flag allows you to save the output of the command to a file. -
-?, -h, --help
: This flag displays the help and usage information for the sub-command.
To decode a JWT token and display its decoded information, run the following command:
nhash encode jwt eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
This will output the decoded information of the JWT token:
Header: (ALGORITHM & TOKEN TYPE)
{
"alg": "HS256",
"typ": "JWT"
}
Payload: (DATA)
{
"sub": "1234567890",
"name": "John Doe",
"iat": 1516239022
}
Summary:
Algorithm: HS256
Issued at: 01/18/2018 01:30:22
Subject: 1234567890