0.0.2 • Published 9 years ago
passport-pass v0.0.2
passport-pass
passport strategy just calling pass().
installation
npm install passport-pass --save
usage
Using this alone does nothing. But by using with other strategies you can easyly create 'authentiated or not' middleware. This is especially useful when creating a server not using session strategy like api sever.
const PassStrategy = require('passport-pass');
passport.use(new PassStrategy());
app.get('api/posts/:postid',
passport.authenticate(['bearer' 'pass'], { session: false }),
function(req, res) {
if (req.isAuthenticated()) {
// do some more stuff
res.json(post);
} else {
res.json(post);
}
});