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.
$ npm install passport-concur
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);
});
}
));
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('/');
});
$ npm install
$ npm test
- Forked from passport-oauth2 by Jared Hanson