我正试图第一次设置护照,只需要一个谷歌登录选项.我在谷歌apis注册,所以我有所有设置.相关代码如下,但是当我的应用程序进行’/ auth / google /’调用时,它就会失败而没有响应或错误消息.我已经开启配置了很多方法都无济于事.我还用一个带有console.log的匿名函数替换了passport.authenticate(‘google’),以便仔细检查我的web服务是否正常运行.所以我知道它已经到了passport.authenticate(‘google’).
@H_404_2@// serialize session
passport.serializeUser(function (user,done) {
done(null,user.id);
});
passport.deserializeUser(function (obj,obj);
});
// use google strategy
passport.use(new googleStrategy({
clientID: config.google.clientID,clientSecret: config.google.clientSecret,callbackURL: config.google.callbackURL,scope: 'https://www.google.com/m8/Feeds https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile'
},function(accessToken,refreshToken,profile,done) {
console.log(profile);
}
));
app.use(passport.initialize());
app.use(passport.session());
app.get('/auth/google',passport.authenticate('google'));
app.get('/auth/google/callback',passport.authenticate('google',{ failureRedirect: '/',scope: 'https://www.google.com/m8/Feeds' }),signin);
编辑:
这是我的http请求,我正在使用角度,这个功能与按钮上的ng-click相关联.
那些日志什么都不返回