2016-08-16 85 views
0

我使用passport-saml将我的角度应用程序与我的企业id服务连接起来。SAML获取CORS的角度

我能够成功地拨打http://example.com/#/,我的网页加载登录按钮。登录按钮会生成一个失败的CORS请求。

$scope.signIn = function() { 
    $http.get('http://example.com/auth') 
     .success(function(data) { 
      console.log('SUCCESS'); 
      console.log(data); 
     }) 
     .error(function(data) { 
      console.log('ERROR'); 
      console.log(data); 
     }); 
}; 

但是,如果我访问http://example.com/auth第一,然后去http://example.com/#/我没有得到一个CORS请求,我能得到我所需要的对象。

任何人都可以帮助我理解为什么我无法从上面的代码中将SAML对象导入到我的角度应用程序中?

回答

0

,您是否试图

$sce.trustAsResourceUrl('http://example.com/auth'); 

代码:

$scope.url = $sce.trustAsResourceUrl('http://example.com/auth'); 
$scope.signIn = function() { 
    $http.get($scope.url) 
     .success(function(data) { 
      console.log('SUCCESS'); 
      console.log(data); 
     }) 
     .error(function(data) { 
      console.log('ERROR'); 
      console.log(data); 
     }); 
};