Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 无法从facebook获取passport_Node.js_Facebook_Passport Facebook - Fatal编程技术网

Node.js 无法从facebook获取passport

Node.js 无法从facebook获取passport,node.js,facebook,passport-facebook,Node.js,Facebook,Passport Facebook,在学习passport中间件时,我试图将其与新的Express 4路由器功能集成 但在尝试passport facebook中间件时,使用以下代码: router.route('/auth/facebook') .get(passport.authenticate('facebook', {scope : 'email'})); router.route('auth/facebook/callback') .get( passport.authenticate('faceboo

在学习passport中间件时,我试图将其与新的Express 4路由器功能集成

但在尝试passport facebook中间件时,使用以下代码:

router.route('/auth/facebook')
    .get(passport.authenticate('facebook', {scope : 'email'}));

router.route('auth/facebook/callback')
    .get( passport.authenticate('facebook', {
        successRedirect : '/profile',
        failureRedirect : '/'
    }));
我遇到了以下问题:

Error: read ETIMEDOUT
at Strategy.OAuth2Strategy._createOAuthError (/Users/home/WorkSpaces/MEAN/EasyAuth/node_modules/passport-facebook/node_modules/passport-oauth2/lib/strategy.js:348:17)
at /Users/home/WorkSpaces/MEAN/EasyAuth/node_modules/passport-facebook/node_modules/passport-oauth2/lib/strategy.js:171:43
at exports.OAuth2.getOAuthAccessToken (/Users/home/WorkSpaces/MEAN/EasyAuth/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:177:18)
at ClientRequest.exports.OAuth2._executeRequest (/Users/home/WorkSpaces/MEAN/EasyAuth/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:148:5)
at ClientRequest.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1551:9)
at CleartextStream.emit (events.js:95:17)
at Socket.onerror (tls.js:1455:17)
at Socket.emit (events.js:117:20)
at Socket._destroy.self._writableState.errorEmitted (net.js:440:14) 

请看下面的优秀教程


ETIMEDOUT可能是无效的重定向uri,但很难从错误消息中分辨出来。

谢谢,是的,我正在查看此tut,但它仍然使用express 3样式的app.get函数;我正在尝试将其迁移到express 4风格的router.rout风格的代码中。但似乎效果不太好有一部分他们展示了到Express4的迁移。最后一页。