这是我console.log(req)
时的结果 sessions:
[Object: null prototype] {
W0Hf0EhynlOrE8zk8fXYSv7DrkwmT9UA:
'{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"passport":{"user":{"ID":9,"TenDangNhap":"mrhauphan","Email":"mrhauphan@gmail.com","Password":"$2b$10$Cngpb.5KHcrCWWuhYy1Tx.AxFpG5GAwGVDOr9jPmXslAFDS8lxTbO","Quyen":"","HoTen":"Phan Văn Hậu","NgaySinh":"15/07/1998","ButDanh":"","ID_CMQL":0,"NgayConLai":0}}}' },
generate: [Function] },
sessionID:“ W0Hf0EhynlOrE8zk8fXYSv7DrkwmT9UA”, 会议: 会议{ 曲奇饼: {path:'/', _expires:空, originalMaxAge:null, httpOnly:true}, 护照:{用户:[对象]}},
答案 0 :(得分:0)
从您在帖子中显示的对象的外观来看,您很可能需要执行console.log(req.session.passport.user)之类的操作。从我可以看到,该请求没有直接在其上的用户对象,它存在于嵌套的子对象上。