Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 28, 2024 via pnpm

passport-local 1.0.0

Local username and password authentication strategy for Passport.
Package summary
Share
0
issues
1
license
2
MIT
Package created
23 Oct 2011
Version published
8 Mar 2014
Maintainers
1
Total deps
2
Direct deps
1
License
UNKNOWN

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
passport-local@1.0.0
passport-strategy@1.0.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of passport-local 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
passport-strategy1.0.02.42 kBMIT
prod

Visualizations

Frequently Asked Questions

What does passport-local do?

Passport-Local is an authentication strategy for Passport.js. It allows applications to authenticate users using a username and password in Node.js applications. This strategy, as part of Passport, can be effortlessly integrated into any application or framework that supports Connect-style middleware, including Express.

How do you use passport-local?

Using Passport-Local involves a straightforward process. First, you need to install it via npm with the command npm install passport-local.

Then you configure the strategy which requires a verify callback. This callback accepts the username and password, and calls done providing a user. Here's an example:

var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;

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

To authenticate requests, use passport.authenticate(), specifying the 'local' strategy. For example:

var express = require('express');
var passport = require('passport');
var app = express();

app.post('/login', 
  passport.authenticate('local', { failureRedirect: '/login' }),
  function(req, res) {
    res.redirect('/');
  }
);

These examples serve as a basic guide, but for comprehensive usage and implementation, refer to the multiple examples included in the package's repository.

Where are the passport-local docs?

For a detailed and thorough understanding of Passport-Local, you'll want to check out the official Passport-Local documentation, which is located in its GitHub repository (git://github.com/jaredhanson/passport-local.git). This page contains all the necessary instructions and explanations for everything you would need to about Passport-Local.