Javascript 使用angularjs routeprovider进行passport facebook身份验证
我有一个angularjs和节点expressjs应用程序。当我尝试实现facebook登录()时。 但问题是当我试着Javascript 使用angularjs routeprovider进行passport facebook身份验证,javascript,facebook,node.js,angularjs,authentication,Javascript,Facebook,Node.js,Angularjs,Authentication,我有一个angularjs和节点expressjs应用程序。当我尝试实现facebook登录()时。 但问题是当我试着 app.get('/auth/facebook',passport.authenticate('facebook')); app.get('/auth/facebook/callback',passport.authenticate('facebook', { successRedirect: '/profile',
app.get('/auth/facebook',passport.authenticate('facebook'));
app.get('/auth/facebook/callback',passport.authenticate('facebook',
{
successRedirect: '/profile',
failureRedirect: '/'
}));
而配置如下—
passport.use(new FacebookStrategy({
clientID: 'xxxx',
clientSecret: 'xxxx',
callbackURL:'http://campustop.in/auth/facebook/callback'
},
function(accessToken,refreshToken,profile,done){
console.log(profile);
}
));
所以,这里的问题是,在我的客户方面,如果我尝试-
<a href="/auth/facebook">Login with Facebook</a>
以及“网络”选项卡中的一些响应标头。您可以通过转到来检查它们。我通过向链接标记添加target=“\u self”来解决这个问题,如下所示
<a href="/auth/google" target="_self">Sign in with Google</a>
当您执行此操作时,angular route provider将忽略它,并允许请求命中您的服务器 你是一个伟大的英雄
<a href="/auth/google" target="_self">Sign in with Google</a>