From 45613cda0ec5cd66dd2850c012ce47937335457d Mon Sep 17 00:00:00 2001 From: Sahat Yalkabov Date: Mon, 10 Feb 2014 19:21:54 -0500 Subject: [PATCH] Add venmo authorize, callback and API urls, and a corresponding Venmo controller --- app.js | 6 ++++++ controllers/api.js | 6 ++++++ views/api/index.jade | 2 ++ 3 files changed, 14 insertions(+) diff --git a/app.js b/app.js index 0ab040ccd0..829448bb07 100755 --- a/app.js +++ b/app.js @@ -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. diff --git a/controllers/api.js b/controllers/api.js index 0bd1c493ae..8aaffac234 100644 --- a/controllers/api.js +++ b/controllers/api.js @@ -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' + }); +}; \ No newline at end of file diff --git a/views/api/index.jade b/views/api/index.jade index 3f72229cbb..2d08b983ff 100644 --- a/views/api/index.jade +++ b/views/api/index.jade @@ -34,3 +34,5 @@ block content small ⇢ Login Required li a(href='/api/scraping') Web Scraping + li + a(href='/api/venmo') Venmo