Get profile data in getVenmo controller

This commit is contained in:
Sahat Yalkabov
2014-02-10 20:59:39 -05:00
parent 45613cda0e
commit 81d4712ba9
2 changed files with 11 additions and 3 deletions

View File

@ -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
});
});
};