express-authentication-header

Authenticate against any RFC7235 HTTP Authorization header, compatible with express-authentication

Usage no npm install needed!

<script type="module">
  import expressAuthenticationHeader from 'https://cdn.skypack.dev/express-authentication-header';
</script>

README

express-authentication-header

Authenticate against any RFC7235 HTTP Authorization header, compatible with express-authentication.

build status coverage license version downloads

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.');
});