Add venmo authorize, callback and API urls, and a corresponding Venmo controller

pull/2/head
Sahat Yalkabov 2014-02-10 19:21:54 -05:00
parent 862ddb33fd
commit 45613cda0e
3 changed files with 14 additions and 0 deletions

6
app.js
View File

@ -123,6 +123,7 @@ app.get('/api/tumblr', passportConf.isAuthenticated, passportConf.isAuthorized,
app.get('/api/facebook', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getFacebook);
app.get('/api/github', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getGithub);
app.get('/api/twitter', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getTwitter);
app.get('/api/venmo', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getVenmo);
/**
* OAuth routes for sign-in.
@ -149,6 +150,11 @@ app.get('/auth/tumblr', passport.authorize('tumblr'));
app.get('/auth/tumblr/callback', passport.authorize('tumblr', { failureRedirect: '/api' }), function(req, res) {
res.redirect('/api/tumblr');
});
app.get('/auth/venmo', passport.authorize('venmo', { scope: 'access_profile make_payments' }));
app.get('/auth/venmo/callback', passport.authorize('venmo', { failureRedirect: '/api' }), function(req, res) {
console.log('Success');
res.redirect('/api/venmo');
});
/**
* Start Express server.

View File

@ -413,3 +413,9 @@ exports.postTwilio = function(req, res, next) {
res.redirect('/api/twilio');
});
};
exports.getVenmo = function(req, res, next) {
res.render('api/venmo', {
title: 'Venmo API'
});
};

View File

@ -34,3 +34,5 @@ block content
small ⇢ Login Required
li
a(href='/api/scraping') Web Scraping
li
a(href='/api/venmo') Venmo