jwt-decode is a small browser library that helps decoding JWTs token which are Base64Url encoded.
IMPORTANT: This library doesn't validate the token, any well formed JWT can be decoded. You should validate the token in your server-side logic by using something like express-jwt, koa-jwt, Owin Bearer JWT, etc.
Install with npm, bower, or downloading from the build directory of this repository.
Use with AMD, browserify or just include with an script tag.
import { decode } from '@jrg/jwt-decode';
const token = 'eyJ0eXAiO.../// jwt token';
const decoded = decode(token);
console.log(decoded);
/* prints:
* { foo: "bar",
* exp: 1393286893,
* iat: 1393268893 }
*/
npm run build
Should build and the ES5 version should be available via babel in the dist folder.
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
This project is licensed under the MIT license. See the LICENSE file for more info.