It seems that the user is defined, but user.user_id
is not. My framework of choice is express.js and passport.js.
router.post('/requestSale', function(req,res){
console.log('session user: ' + req.session.passport.user); //logs
console.log('session user_id: ' + req.session.passport.user.user_id);
api.initiateSale(req.body.brokerId, req.session.passport.user.user_id, (req.body.amount).toFixed(0), function(sale){
res.render('buying', {title: 'Buying', sale:sale});
});
});
console.log('session user: ' + req.session.passport.user);
logs:
{"user_id":3,"type":"Normal","email":"[email protected]","firstname":"Kinnard","lastname":"Hockenhull"}`
However,
console.log('session user_id: ' + req.session.passport.user.user_id);
logs:
undefined
Why is this happening and how can I resolve it?