Meetup OAuth2 Strategy for Passport
Passport strategy for authenticating with Meetup using the OAuth 2.0 API.
This module lets you authenticate using Meetup in your Node.js applications. By plugging into Passport, Meetup authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.
The Meetup authentication strategy authenticates users using a Meetup
account and OAuth 2.0 tokens. The strategy requires a verify
callback, which
accepts these credentials and calls done
providing a user, as well as
options
specifying a app ID, app secret, and callback URL.
var MeetupStrategy = require('passport-meetup-oauth2').Strategy;
passport.use(new MeetupStrategy({
clientID: MEETUP_KEY,
clientSecret: MEETUP_SECRET,
callbackURL: "http://localhost:3000/auth/meetup/callback"
}, function (accessToken, refreshToken, profile, done) {
// store credentials, etc
});
}
));
Use passport.authenticate()
, specifying the 'meetup'
strategy, to
authenticate requests.
For example, as route middleware in an Express application:
app.get('/auth/meetup', passport.authenticate('meetup'));
app.get('/auth/meetup/callback',
passport.authenticate('meetup', { failureRedirect: '/login' }),
function(req, res) {
// Successul authentication, redirect home.
res.redirect('/');
});
Created by Joe Woodhouse
Code based on passport-mailchimp by Brian Falk