Socket
Book a DemoInstallSign in
Socket

passport-session

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-session

Local username and password with sessionId authentication strategy for Passport.

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
1.1K
-5.15%
Maintainers
1
Weekly downloads
 
Created
Source

passport-session

Install

$ npm install passport-session

Usage

It is the same as passport-local but with a sessionId. It allow you to authenticate your users on differents sessions (or "rooms").

Configure Strategy

passport.use(new LocalStrategy(
  function(email, password, sessionId, done) {
    User.findOne({ email: email, sessionId: sessionId }, 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);
    });
  }
));
Available Options

This strategy takes an optional options hash before the function, e.g. new LocalStrategy({/* options */, callback}).

The available options are:

  • emailField - Optional, defaults to 'email'
  • passwordField - Optional, defaults to 'password'
  • sessionIdField - Optional, defaults to 'sessionId'

This fields define the name of the properties in the POST body that are sent to the server.

Keywords

passport

FAQs

Package last updated on 17 Oct 2016

Did you know?

Socket

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.

Install

Related posts