A simple Passport strategy for Addressix OAuth2.

Install

npm install passport-addressix-oauth2

Usage

Register the strategy

var AddressixStrategy = require('passport-addressix-oauth2').Strategy;

passport.use(new AddressixStrategy({
  clientID: ADDRESSIX_CLIENT_KEY,
  clientSecret: ADDRESSIX_CLIENT_SECRET,
  callbackURL: "http://127.0.0.1:3000/auth/callback"
}, function(accessToken, refreshToken, profile, done) {
   User.findOrCreate({ exampleId: profile.id }, function (err, user) {
      return cb(err, user);
    });
}));

Authenticate Requests

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

For example, as route middleware in an Express application:

app.get('/someroute/example',
  passport.authenticate('addressix'));

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

License

The MIT License

Supported by

SEARCH FOR STRATEGIES

0STRATEGIES