Hi,

I am using passport js bearer strategy for session authentication.

passport.use(new BearerStrategy(
  function(token, done) {
    Student.findOne({ token: token }, function (err, student) {
      if (err) { return done(err); }
      if (!student) { return done(null, false); }
      return done(null, student, { scope: 'all' });
    });
  }
));


which get fire whenever a request comes having '/secure' prefix.


router.all('/secure/*',passport.authenticate('bearer', { session: false 
}),function(req,res,next){
        next();
});


but this authentication is done only for students. Suppose if there is teachers 
also so how will I do the same?

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/635ae1b8-aefb-4a29-8116-06c75ecfa240%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to