我正在尝试使用password.js使用Facebook登录身份验证用户。我能够登录到Facebook,然后出现以下错误
TokenError:验证码格式错误。
app.get('/facebook',passport.authenticate('facebook'));
passport.use(new FacebookStrategy({
clientID: FACEBOOK_APP_ID,
clientSecret: FACEBOOK_SECRET_KEY,
callbackURL: "facebook/redirect"
},
function(accessToken, refreshToken, profile, done) {
console.log("authenticated");
}
));
app.get("/facebook/redirect",passport.authenticate("facebook"),function(req,res)
{
console.log("hey");
});
答案 0 :(得分:0)
尝试在重定向URI中添加斜杠
passport.use(new FacebookStrategy({
clientID: FACEBOOK_APP_ID,
clientSecret: FACEBOOK_SECRET_KEY,
callbackURL: "facebook/redirect/"
},
function(accessToken, refreshToken, profile, done) {
console.log("authenticated");
}
));