passport-multi-type

1.0.0 • Public • Published

passport-multi-type extend for passport-local

Build Coverage Quality Dependencies Tips

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-multi-type

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(type, username, password, done) {
    // ....
  }
));
Available Options

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

The available options are:

  • typeField - Optional, defaults to 'type'
  • usernameField - Optional, defaults to 'username'
  • passwordField - Optional, defaults to 'password'

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

Parameters

By default, LocalStrategy expects to find credentials in parameters named username and password. If your site prefers to name these fields differently, options are available to change the defaults.

passport.use(new LocalStrategy({
    typeeField: 'type',
    usernameField: 'email',
    passwordField: 'passwd',
    session: false
  },
  function(username, password, done) {
    // ...
  }
));

License

The MIT License

Copyright (c) 2018-2028 MicahChiu

Readme

Keywords

Package Sidebar

Install

npm i passport-multi-type

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

6.32 kB

Total Files

5

Last publish

Collaborators

  • micahchiu