micro-jwt-auth
json web token(jwt) authorization wrapper for Micro
An
Authorization
header with valueBearer MY_TOKEN_HERE
is expected
examples
with no other wrappers
'use strict' const jwtAuth = /* if Authorization Bearer is not present or not valid, return 401*/ moduleexports = asyncreq res return `Ciaone !`
with multiple wrappers
'use strict' const jwtAuth = const compose = fns const handle = asyncreq res return `Ciaone !` moduleexports = handle
with whitelist of paths
Whitelisted paths make JWT token optional. However if valid token is provided it will be decoded.
'use strict' const jwtAuth = /* Bypass authentication for login route*/ moduleexports = asyncreq res return `Ciaone !`
with custom responses
'use strict' const jwtAuth = /* You can overwrite the default response with the optional config object*/ moduleexports = asyncreq res return `Ciaone !` /* You may skip the whitelist if unnecessary*/ moduleexports = asyncreq res return `Ciaone !`