护照 js 的 facebook 策略没有将数据传递给下一个函数
facebook strategy of passportjs is not passing data to next funtion
我对护照 Facebook 策略有疑问。
这是我的路线:
app.post('/auth/facebook',
passport.authorize('facebook-token', {session: false}),
socialAuths.fbAuth
);
这是护照号码:
passport.use(new FacebookTokenStrategy({
clientID: config.facebookAuth.clientID,
clientSecret: config.facebookAuth.clientSecret
},
function(accessToken, refreshToken, profile, done) {
return done(accessToken, profile);
}));
这是应该在 passport.use
的回调函数之后调用的函数:
fbAuth(req, res, next){
console.log(req.accessToken, req.profile);
};
但对我来说,这个函数没有被调用 请求结束于 return done(accessToken, profile);
我做错了什么?
这帮我修好了
return done(null, {accessToken, profile});
done 函数接受完整的参数
第一个错误
其次是将附加到 req 对象并可在下一个中间件中访问的数据
第三个是可选消息
我对护照 Facebook 策略有疑问。 这是我的路线:
app.post('/auth/facebook',
passport.authorize('facebook-token', {session: false}),
socialAuths.fbAuth
);
这是护照号码:
passport.use(new FacebookTokenStrategy({
clientID: config.facebookAuth.clientID,
clientSecret: config.facebookAuth.clientSecret
},
function(accessToken, refreshToken, profile, done) {
return done(accessToken, profile);
}));
这是应该在 passport.use
的回调函数之后调用的函数:
fbAuth(req, res, next){
console.log(req.accessToken, req.profile);
};
但对我来说,这个函数没有被调用 请求结束于 return done(accessToken, profile);
我做错了什么?
这帮我修好了
return done(null, {accessToken, profile});
done 函数接受完整的参数
第一个错误 其次是将附加到 req 对象并可在下一个中间件中访问的数据 第三个是可选消息