@sineverba/jwt-decoder
v1.4.2
Published
Decodes a JWT Token as an object
Downloads
22
Readme
JWT decoder
| CI / CD | Status | | ------- | ------ | | NPM | | | Semaphore CI | | | Circle CI | | | Coverall | | | SonarCloud | |
jwt-decoder
decodes a JWT Token as an object.
Installation
npm install @sineverba/jwt-decoder
Usage
import { parseJwt } from "@sineverba/jwt-decoder";
const token =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
const parsedToken = parseJwt(token);
console.log(parsedToken); // returns {"sub": "1234567890", "name": "John Doe", "iat": 1516239022};
Tests
npm run test
for simple test
npm run cover
for coverage