passport-concur

Fork of passport-oauth2 to provide Concur-specific OAuth 2.0 authentication strategy for Passport.

This module lets you authenticate using Concur in your Node.js applications. By plugging into Passport, Concur's OAuth 2.0 authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.

Install

$ npm install passport-concur

Usage

Configure Strategy

The Concur authentication strategy authenticates users using a Concur account and OAuth 2.0 tokens. The strategy requires a verify callback, which receives an access token and profile, and calls done providing a user.

passport.use(new ConcurStrategy({
    clientID: EXAMPLE_CLIENT_ID,
    clientSecret: EXAMPLE_CLIENT_SECRET,
    callbackURL: "http://localhost:3000/auth/example/callback"
  },
  function(accessToken, refreshToken, instanceUrl, expirationDate, done) {
    User.findOrCreate({ exampleId: profile.id }, function (err, user) {
      return done(err, user);
    });
  }
));

Authenticate Requests

Use passport.authenticate(), specifying the 'concur' strategy, to authenticate requests.

For example, as route middleware in an Express application:

app.get('/auth/example',
  passport.authenticate('concur'));

app.get('/auth/example/callback',
  passport.authenticate('concur', { failureRedirect: '/login' }),
  function(req, res) {
    // Successful authentication, redirect home.
    res.redirect('/');
  });

Tests

$ npm install
$ npm test

Credits

License

The MIT License

Supported by

SEARCH FOR STRATEGIES

0STRATEGIES