Add Venmo oauth2 strategy
This commit is contained in:
@ -242,6 +242,24 @@ passport.use('foursquare', new OAuth2Strategy({
|
||||
}
|
||||
));
|
||||
|
||||
passport.use('venmo', new OAuth2Strategy({
|
||||
authorizationURL: 'https://api.venmo.com/v1/oauth/authorize',
|
||||
tokenURL: 'https://api.venmo.com/v1/oauth/access_token',
|
||||
clientID: secrets.venmo.clientId,
|
||||
clientSecret: secrets.venmo.clientSecret,
|
||||
callbackURL: secrets.venmo.redirectUrl,
|
||||
passReqToCallback: true
|
||||
},
|
||||
function (req, accessToken, refreshToken, profile, done) {
|
||||
User.findById(req.user._id, function(err, user) {
|
||||
user.tokens.push({ kind: 'venmo', accessToken: accessToken });
|
||||
user.save(function(err) {
|
||||
done(err, user);
|
||||
});
|
||||
});
|
||||
}
|
||||
));
|
||||
|
||||
exports.isAuthenticated = function(req, res, next) {
|
||||
if (req.isAuthenticated()) return next();
|
||||
res.redirect('/login');
|
||||
|
Reference in New Issue
Block a user