Angularjs passport.js auth0策略交叉登录请求错误
我正在尝试在我的web应用程序中使用auth0进行社会验证 我像这样配置了应用程序Angularjs passport.js auth0策略交叉登录请求错误,angularjs,node.js,passport.js,passport-facebook,auth0,Angularjs,Node.js,Passport.js,Passport Facebook,Auth0,我正在尝试在我的web应用程序中使用auth0进行社会验证 我像这样配置了应用程序 auth0 : { domain : "mydomain", clientID : "myid", clientSecret: "mysecret", callbackURL: "/callback" }, app.get('/callback', passport.authenticate('auth0', { failureRedirect: '#!/authServiceImpl/logi
auth0 : {
domain : "mydomain",
clientID : "myid",
clientSecret: "mysecret",
callbackURL: "/callback"
},
app.get('/callback', passport.authenticate('auth0', { failureRedirect: '#!/authServiceImpl/login' }),
function(req, res) {
console.log('auth0 callback');
console.log(req.user);
}
);
我请求使用http从angular controller登录到节点后端,如
app.get('/auth/:connection', function(req, res, next) {
passport.authenticate('auth0', {connection: req.params.connection}, function(err, user, info) {
}) (req, res, next);
});
我会像auth/facebook一样从客户端控制器调用facebook登录
回调路由的配置如下
auth0 : {
domain : "mydomain",
clientID : "myid",
clientSecret: "mysecret",
callbackURL: "/callback"
},
app.get('/callback', passport.authenticate('auth0', { failureRedirect: '#!/authServiceImpl/login' }),
function(req, res) {
console.log('auth0 callback');
console.log(req.user);
}
);
每次我收到跨源请求错误时。
我做错了什么
我请求使用http从angular controller登录到节点后端,如
app.get('/auth/:connection', function(req, res, next) {
passport.authenticate('auth0', {connection: req.params.connection}, function(err, user, info) {
}) (req, res, next);
});
不能在XHR上执行OAuth。您需要执行window.location.pathname='/auth/whatever'
或window.open('/auth/whatever')