jwt-parser
v2.0.0
Published
jwt header parser
Downloads
35
Readme
jwt-parser
Generic JWT Authorization header field parser for whatever.
Installation
$ npm install jwt-parser
API
var auth = require('jwt-parser')
auth(req, secret)
Get the JWT payload from the given request. JWT secret
also required so
it can decode and get payload correctly. The Authorization
header is parsed and if the header is invalid, undefined
is returned,
otherwise will return decode jwt payload.
Example
var auth = require('jwt-parser');
var user = auth(req, secret);