I came across several issues getting this to work today:
faceplate index.js passes the error as the first param to the callback e.g.
this.me = function(cb) {
if (self.token) {
self.get('/me', function(err, me) {
console.log('get fb user: ' + JSON.stringify(me) + ', err: ' + err);
cb(err,me);
});
} else {
console.log('error get fb user no token');
cb(null,null);
}
};
but in web.js it has:
req.facebook.me(function(user) {
when should be
req.facebook.me(function(err, user) {
same issue applies to get and fql calls in handle_facebook_request
Also it looks like the data object that faceplate returns in the success callback for the get request stores the friends in a field called data so where faceplate calls the callback like this:
request.on('success', function(data) {
cb(null, data);
});
in web.js to get friends would be:
function(cb) {
// query 4 friends and send them to the socket for this socket id
req.facebook.get('/me/friends', { limit: 4 }, function(err, friends) {
req.friends = friends.data;
cb();
});
},