How to update req.user session object set by passportjs?

前端 未结 5 1288
抹茶落季
抹茶落季 2020-12-17 10:49

I\'m trying to do this since a lot of days but all my tests fails...

Users on my platform connect them by using passportjs strategies (paypal, facebook, google...).<

5条回答
  •  旧巷少年郎
    2020-12-17 11:38

    This is still one of the top results for 'update session passport js', so I thought I'd add what worked for me (the provided answers didn't work for me):

    req.session.passport.user.updatedfield= 'updatedvalue'
    req.session.save(function(err) {console.log(err);}
    

    Without req.session.save() the session data would not update for me. Hope this helps someone.

提交回复
热议问题