req.user problem
the-einstein opened this issue · 3 comments
I wanted to add types to user as admin or just user. but I am not realizing where you gave these params
{
name: 'name ',
username: 'username ',
_id: id
}
i want to add new param here as role, but anytime I change the page the req.user params are also hanged and got got only these three params.
I want to have
{
name: 'name',
username: 'username',
role: "role",
_id: id
}
you need to edit user schema from user model
and add role
in its's schema and give it a default value as user
you need to edit user schema from
user model
and addrole
in its's schema and give it a default value asuser
I am sorry but this won't help in my condition
It depends what you deserialise and pass to the req.user in session.
This is where you change it. https://github.com/madhums/node-express-mongoose-demo/blob/master/config/passport.js#L23
Check out https://stackoverflow.com/questions/27637609/understanding-passport-serialize-deserialize