Module for authorization verification.
$ 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.