答案 0 :(得分:1)
passport.authenticate
返回一个函数。
您可以尝试
console.log(passport.authenticate('basic', { session: false }));
它会打印出类似的东西
function(req, res, next){ ... }
这意味着app.get
在您的应用启动后将看起来像这样
app.get('/api/me',
function(req, res, next){
// now passport has access to the "req" even though you didn't pass request to it
// passport's authentication logic here
},
function(req, res) {
res.json(req.user);
});