
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
passport-http-header-token
Advanced tools
Passport strategy for authenticating with a http header token
Passport strategy for authenticating with a http header token - based on passport-local.
This module lets you authenticate using a username and password in your Node.js applications. By plugging into Passport, local authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.
$ npm install passport-http-header-token
The http header token authentication strategy authenticates users using a token.
The strategy requires a verify
callback, which accepts the
credential and calls done
providing a user.
passport.use(new HTTPHeaderTokenStrategy(
function(token, done) {
User.findOne({ token: token }, function (err, user) {
if (err) { return done(err); }
if (!user) { return done(null, false); }
return done(null, user);
});
}
));
Use passport.authenticate()
, specifying the 'http-header-token'
strategy, to
authenticate requests.
For example, as route middleware in an Express application:
app.post('/login',
passport.authenticate('http-header-token', { failureRedirect: '/login' }),
function(req, res) {
res.redirect('/');
});
For a complete, working example, refer to the HTTP Header Token example.
$ npm install
$ npm test
Copyright (c) 2011-2014 Pelle Almquist
FAQs
Passport strategy for authenticating with a http header token
The npm package passport-http-header-token receives a total of 626 weekly downloads. As such, passport-http-header-token popularity was classified as not popular.
We found that passport-http-header-token demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.