express-authentication-header
v0.2.0
Published
Authenticate against any RFC7235 HTTP Authorization header, compatible with express-authentication
Downloads
99
Maintainers
Readme
express-authentication-header
Authenticate against any RFC7235 HTTP Authorization
header, compatible with express-authentication.
var header = require('express-authentication-header'),
auth = require('express-authentication');
// Validate the challenge
app.use(header({
scheme: 'API',
verify: function(challenge, callback) {
callback(null, challenge.token === 'secret');
}
}));
app.get('/', auth.required(), function(req, res) {
res.status(200).send('Hello world.');
});