0.0.14 • Published 10 years ago

passport-password-grant v0.0.14

Weekly downloads
1
License
-
Repository
-
Last release
10 years ago

passport-password-grant

HTTP OAuth2.0 Password Grant authentication strategy for Passport.

This module lets you authenticate users via username and password provided to an authozization server using a password grant REST call and receiving a access token and refresh token issued using OAuth 2.0.

Usage

Configure Strategy

The grant strategy will return a token containing token.access_token and token.refresh_token

    passport.use(new GrantStrategy({
      usernameField: 'email',
      passwordField: 'password',
      clientId: 'theClientId',
      scope: 'theScope',
      host: 'https://auth.server'
      port: '8443',
      function(token, done) {
        // Do something with the token
      }
    ));

Authenticate Requests

Use passport.authenticate(), specifying the 'password-grant' strategy, to authenticate requests.

    passport.authenticate('password-grant',
      function(req, res) {
        res.json(req.user);
      }
    );

License

The MIT License

0.0.14

10 years ago

0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

1.0.1

10 years ago