0
votes

it is the result when I console.log(req)

 sessions:
  [Object: null prototype] {
    W0Hf0EhynlOrE8zk8fXYSv7DrkwmT9UA:
     '{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"passport":{"user":{"ID":9,"TenDangNhap":"mrhauphan","Email":"[email protected]","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', session: Session { cookie: { path: '/', _expires: null, originalMaxAge: null, httpOnly: true }, passport: { user: [Object] } },

1
Maybe you are not deserializing user properlyVirgilioGM

1 Answers

0
votes

From the looks of the object you show in the post, you most likely need to do something like console.log(req.session.passport.user). From what I can see, the request does not have a user object directly on it, it exists on a nested child object.