auth-handler-nt
v1.0.3
Published
Authorization library with API Token verification and JWT verification
Downloads
13
Readme
AuthHandler
Module for authorization verification.
Installation
$ yarn install auth-handler-nt --save
## Documentation
configure(obj) Set configuration object before using other functions. Example :
{ "JWT_TOKEN": "TESTJWT", "API_KEY": "SUPERAPIKEY" }
checkAPIKey(req, res, next) Middleware for API KEY checking. Returns error with status 401 if wrong API KEY.
checkJWT(req, res, next) Middleware for JWT checking. Returns error with status 401 if wrong JWT.
createJWT_HMAC(exp, data, JWT_TOKEN = null) Return JWT using HMAC algorithm. You can override the config JWT by giving another token in parameter.