Friday, February 23, 2018

jwt-decode - Decode a JWT token in your browser

During the preparation for a training I found the following great utility library; jwt-decode.

jwt-decode is a small browser library that helps decoding JWTs token which are Base64Url encoded.


I installed the library using

npm install jwt-decode


As I’m using webpack I was able to include the package using a require

var jwtDecode = require('jwt-decode');
Next step is to take the token and call jwtDecode:
var token = 'eyJ0eXAiO.../// jwt token';

var decoded = jwt_decode(token);

No comments: