I am trying to make the authorization for nodebb by link. I try to use the strategy passport-http-bearer
var Strategy = require('passport-http-bearer').Strategy;
var passport_two = require('passport');
passport_two.use(new Strategy(
function(token, cb) {
//db.users.findById(token, function(err, user) {
// if (err) { return cb(err); }
// if (!user) { return cb(null, false); }
return cb(null, 1); // where 1 number user for example
});
}));
app.get('/secret',
passport_two.authenticate('bearer', { session: true }),
function(req, res) {
res.json(req.user);
});
but there is no authorization. Why?
How I can authorization a user on the site by email or id?