diff --git a/app.js b/app.js index 829448bb07..80c5568c83 100755 --- a/app.js +++ b/app.js @@ -150,7 +150,7 @@ 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', passport.authorize('venmo', { scope: 'make_payments access_profile access_balance access_email access_phone' })); app.get('/auth/venmo/callback', passport.authorize('venmo', { failureRedirect: '/api' }), function(req, res) { console.log('Success'); res.redirect('/api/venmo'); diff --git a/controllers/api.js b/controllers/api.js index 8aaffac234..4e2729d444 100644 --- a/controllers/api.js +++ b/controllers/api.js @@ -415,7 +415,15 @@ exports.postTwilio = function(req, res, next) { }; exports.getVenmo = function(req, res, next) { - res.render('api/venmo', { - title: 'Venmo API' + var token = _.findWhere(req.user.tokens, { kind: 'venmo' }); + var query = querystring.stringify({ access_token: token.accessToken }); + request.get({ url: 'https://api.venmo.com/v1/me?' + query, json: true }, function(err, request, body) { + if (err) return next(err); + res.render('api/venmo', { + title: 'Venmo API', + profile: body.data + }); + }); + }; \ No newline at end of file