【发布时间】:2016-07-31 17:37:00
【问题描述】:
我从https://devdactic.com/restful-api-user-authentication-1/ 学习了教程。但是我在这部分有错误
passport.use(new JwtStrategy(opts, function(jwt_payload, done)
这是我运行节点“server.js”时的错误
/home/chibi/Documents/connect/project/node_modules/passport-jwt/lib/strategy.js:39
throw new TypeError('JwtStrategy requires a function to retrieve jwt f
^
TypeError: JwtStrategy requires a function to retrieve jwt from requests (see option jwtFromRequest)
at new JwtStrategy (/home/chibi/Documents/connect/project/node_modules/passport-jwt/lib/strategy.js:39:15)
at module.exports (/home/chibi/Documents/connect/project/config/passport.js:10:16)
at Object.<anonymous> (/home/chibi/Documents/connect/project/server.js:30:29)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
解决办法是什么?
【问题讨论】:
-
感谢这篇文章也做了这个教程,也得到了这个错误
标签: node.js passport.js