@shultztom/auth-middleware
v1.1.1
Published
auth middleware for express to help verify tokens
Downloads
3
Readme
auth-middleware
Usage for verifyToken
// import
const { verifyToken } = require("@shultztom/auth-middleware")
// Use at app level
app.use(verifyToken);
// Use at router level
router.get("/", verifyToken, function(req, res, next) {
res.status(200).send('Hello World!');
});
Usage for verifyTokenAndRole
// import
const { verifyTokenAndRole } = require("@shultztom/auth-middleware")
// Use at app level
app.use(verifyTokenAndRole("my-role"));
// Use at router level
router.get("/", verifyToken("my-role"), function(req, res, next) {
res.status(200).send('Hello World!');
});
Pre-requisites
- Must have account registered at
https://auth-api-go.shultzlab.com/
- https://github.com/shultztom/auth-api-go