How to decode JSON Web Token (JWT) offline
Written by - Millan Kaul
JSON Web Token (JWT) is pronounced as “jot”
I will show you How to decode jwt token using postman in 2 minutes !!
Most of the developers and QA have pasted jwt tokens on https://jwt.io as nothing else seems more reliable than that to copy your secrets. But its less of a fact that we read this on the same website
Warning: JWTs are credentials, which can grant access to resources. Be careful where you paste them! We do not record tokens, all validation and debugging is done on the client side.
Postman Test tab
var jwt_token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
var one = JSON.parse(atob(jwt_token.split('.')[0]));
var two = JSON.parse(atob(jwt_token.split('.')[1]));
var three = jwt_token.split('.')[2];
console.log (one);
console.log (two);
console.log (three);
And you will see this in the result tab at bottom
pm.test('one -----> ' + JSON.stringify(one), function () {});
pm.test('two -----> ' + JSON.stringify(two), function () {});
pm.test('three ---> ' + three, function () {});
Test Result tab showing decoded values of jwt token