且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将passport.authenticate 包装在函数中不起作用

更新时间:2023-11-14 15:53:58

试试这个,让我们知道它是否有效.(您必须在功能结束时提供 (res,req,next),如本链接中所述http://passportjs.org/文档)

Try this and let us know if its work. (you have to provide (res,req,next) in end of function as described in this link http://passportjs.org/docs)

server.get('/user/google', function(req, res, next) {
  passport.authenticate('google', {
     scope: ['openid email profile']
  } ,function(err, user, info){
    res.send(user);
  })(req,res,next);
})