0.1.9 • Published 5 years ago
@g4br13l/basic-auth v0.1.9
Basic-Auth to be used with Express.js
How to install
npm i @g4br13l/basic-auth
How to use
const router = express.Router();
const BasicAuth = require("@g4br13l/basic-auth");
const newBasicAuth = new BasicAuth("testUser", "testPassword");
router.get("/test", newBasicAuth.protect, (req, res, next) => res.status(200).send());
module.exports = router;
Responses
Matching Credentials
StatusCode: 200
Sends next() to express
Invalid credentials
StatusCode: 401
{
"message": "Invalid Authentication Credentials"
}
No authentication provided
StatusCode: 401
{
"message": "Missing Authorization Header"
}