I am trying this git example.
Which works well when I integrated it with my project, but what I want to achieve is to send json as a response to the client/request,
Use passport as a middleware.
router.get('/auth/callback', passport.authenticate('facebook'), function(req, res){ if (req.user) { res.send(req.user); } else { res.send(401); } });