2016-07-18 21 views
0

我试图实现facebook集成,我得到这个错误:我尝试使用Facebook的护照实施facebook集成,我得到一个错误

XMLHttpRequest cannot load https://www.facebook.com/dialog/oauth?response_type=code&redirect_uri=http%3A%2F%2Fchefin.com%2Fauth%2Ffacebook%2Fcallback&client_id=865410220269534 . No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://chefin.com ' is therefore not allowed access.

当我打电话按钮点击auth/facebook URL。

$scope.facebookLogin = function() { 

     $http({ 
      url: '/auth/facebook', 
      method: 'GET', 
     }).success(function(response) { 
     }); 
    }; 

回答

0

看来/ auth/facebook有一个重定向请求。因此,您可以尝试使用AJAX代替:

$scope.facebookLogin = function() { 
    window.location.href = "/auth/facebook"; 
} 
相关问题