jwtextract
v1.0.2
Published
extract and parse jwt from headers
Downloads
4
Maintainers
Readme
jwtextract
fast extract your jwt from your authorization header
Usage
Install with
$ npm i jwtextract
or
$ yarn add jwtextract
HOW TO :
import jwtextract from 'jwtextract'
export const authenticateUser = async (req, res, next) => {
// sent in the req and expect to get string jwt as return value
const accessToken = jwtextract(req)
if (!accessToken) {
// response with some error
return responseWithError(res, error(FORBIDDEN_MSG, FORBIDDEN))
}
else{
// do your magic code...
}
}