You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this is the only place where I use permission.
Also I created a field named 'role' in my User schema.
Then I debugged my app and observe that at this point:
if(req.isAuthenticated()&&!req.user[role])thrownewError("User doesn't have property named: "+role+". See Advantage Start in docs")
req.user is undefined
but console.log(req.session.passport) returns me:
user: '57338a9a5c52e9159fc89095'
it mean that user is authorized and there is a record in session, but req.user is undefined;
my suggestion is that permission checks req.user before it actually filled by passport.deserializeUser()
How do you use permission with Passportjs?
Thanks in advance!
The text was updated successfully, but these errors were encountered:
Sorry for disturbing, but it was my fault. For anyone who run into the same problem: double check your mongoose Schema, and rerun the server (it was my problem, I install npm, add field to existing user with MongoChef, but haven't update the Schema);
Hi there!
I using PassportJS to authenticate users on my site.
My routes looks like:
/routes/songs.js:
this is the only place where I use permission.
Also I created a field named 'role' in my User schema.
Then I debugged my app and observe that at this point:
req.user is undefined
but console.log(req.session.passport) returns me:
user: '57338a9a5c52e9159fc89095'
it mean that user is authorized and there is a record in session, but req.user is undefined;
my suggestion is that permission checks req.user before it actually filled by passport.deserializeUser()
How do you use permission with Passportjs?
Thanks in advance!
The text was updated successfully, but these errors were encountered: