Passport.js and Mongoose.js populate User on login - loses populated field on req.user
The problem was that I was not populating the field in the passport.deserializeUser function, here is the updated function:
//deserializepassport.deserializeUser(function(id, done) { User.findById(id) .populate('companyRoles._company', ['name', '_id']) .run(function (err, user) { done(err, user); });});
It looks like in your res.redirect
you're trying to construct a URL by concatenating an object to a string. I doubt that will have the result you want. What do you expect the URL to look like?