我正在尝试使用护照为github设置oauth策略。这个设置适用于设置推特策略。认为我正在制作一个简单的javascript错误,但不知道在哪里。
var passport = require('passport'),
GithubStrategy = require('passport-github'),
config = require('./config/oauth.js');
passport.use(new GithubStrategy({
clientID: config.github.clientID,
clientSecret: config.github.clientSecret,
callbackURL: config.github.callbackURL
},
function(accessToken, refreshToken, profile, done) {
process.nextTick(function () {
return done(null, profile);
});
}
));
这是我得到的错误堆栈;
passport.use(new GithubStrategy({
^
TypeError: object is not a function
at Object.<anonymous> (/Users/Kevin/gd/proj/priv/Vebulid/app.js:42:14)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/Kevin/gd/proj/priv/Vebulid/bin/www:7:11)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
答案 0 :(得分:1)
您需要使用.Strategy
属性:
var GithubStrategy = require('passport-github').Strategy;