0.0.1 • Published 10 years ago

passport-eloqua v0.0.1

Weekly downloads
2
License
-
Repository
github
Last release
10 years ago

Passport-eloqua

Passport strategy for authenticating with Eloqua using the OAuth 2.0 API.

Install

$ npm install passport-eloqua

Usage

Configure Strategy

EloquaStrategy = require('passport-eloqua').EloquaStrategy;

passport.use(new EloquaStrategy({
    clientID: ELOQUA_CLIENT_ID,
    clientSecret: ELOQUA_CLIENT_SECRET,
    callbackURL: "http://example.com/auth/eloqua/callback"
  },
  function(accessToken, refreshToken, profile, done) {
    User.findOrCreate({ eloquaId: profile.id }, function (err, user) {
      return done(err, user);
    });
  }
));

Authenticate Requests

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

For example, as route middleware in an Express application:

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

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

Thanks

License

The MIT License

Copyright (c) 2011-2014 Jared Hanson [http://jaredhanson.net/](http://jaredhanson.net/), Et al.