Tag: Facebookauthentication

使用护照快速找不到用户的凭证

我面临一个奇怪的问题,我的应用程序使用用户的fb凭据login,但我不能看到他的电子邮件,名称或ID等这里是我在我的users.js路线: – router.get('/auth/facebook',passport.authenticate('facebook', {scope: ['email', 'user_friends']})); router.get('/auth/facebook/callback', passport.authenticate('facebook',{ successRedirect:'/profile',failureRedirect:'/'},function(req,res){ console.log("in passport req"); //doesn't get printed console.log(req); })); 在我的configuration/ passport.js我正在做: – var configAuth=require('./auth'); //holds all appID, secret and successurl var FacebookStrategy=require('passport-facebook').Strategy; var passport=require('passport'); module.exports=function(passport){ passport.use(new FacebookStrategy({ clientID: configAuth.facebookAuth.clientID, clientSecret: configAuth.facebookAuth.clientSecret, callbackURL: configAuth.facebookAuth.callbackURL, profileFields: ['id', 'displayName', 'photos', 'email'] }, function(accessToken, refreshToken, profile, cb) { console.log("the user's credentials […]

在callback函数中,Passport-Facebook访问req对象

在Facebook上为nodejs护照authenticationcallback,你如何获得callback中的req对象? passport.use(new FacebookStrategy({ clientID: 123456789, clientSecret: 'SECRET', callbackURL: "http://example.com/login/facebook/callback" }, function(accessToken, refreshToken, profile, done){ // Is there any way to get the req object in here? } ));