Username and password authentication strategy for Passport and Node.js.
Installations
npm install passport-local
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>= 0.4.0
NPM Version
1.2.25
Score
99.2
Supply Chain
89.5
Quality
75.4
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (98.74%)
Makefile (1.26%)
Developer
Download Statistics
Total Downloads
184,179,027
Last Day
56,641
Last Week
637,512
Last Month
3,611,980
Last Year
43,261,590
GitHub Statistics
2,736 Stars
141 Commits
498 Forks
56 Watching
1 Branches
15 Contributors
Package Meta Information
Latest Version
1.0.0
Package Id
passport-local@1.0.0
Size
3.28 kB
NPM Version
1.2.25
Publised On
08 Mar 2014
Total Downloads
Cumulative downloads
Total Downloads
184,179,027
Last day
-65.2%
56,641
Compared to previous day
Last week
-27.4%
637,512
Compared to previous week
Last month
-5.2%
3,611,980
Compared to previous month
Last year
11.7%
43,261,590
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Dev Dependencies
3
passport-local
Passport strategy for authenticating with a username and password.
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.
Install
$ npm install passport-local
Usage
Configure Strategy
The local authentication strategy authenticates users using a username and
password. The strategy requires a verify
callback, which accepts these
credentials and calls done
providing a user.
passport.use(new LocalStrategy(
function(username, password, done) {
User.findOne({ username: username }, function (err, user) {
if (err) { return done(err); }
if (!user) { return done(null, false); }
if (!user.verifyPassword(password)) { return done(null, false); }
return done(null, user);
});
}
));
Authenticate Requests
Use passport.authenticate()
, specifying the 'local'
strategy, to
authenticate requests.
For example, as route middleware in an Express application:
app.post('/login',
passport.authenticate('local', { failureRedirect: '/login' }),
function(req, res) {
res.redirect('/');
});
Examples
For complete, working examples, refer to the multiple examples included.
Tests
$ npm install
$ npm test
Credits
License
Copyright (c) 2011-2014 Jared Hanson <http://jaredhanson.net/>
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 existing vulnerabilities detected
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3
/10
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More