$scope.status = function()
{
$http({url:'url', method:"GET", withCredentials: false, headers:{
'Authorization': 'Token ' + token,
}
})
.success(function(result) {
console.log("Success", result);
$scope.resultGet = result;
alert("success");
})
.error(function(error, status, header, config) {
$scope.error = { message: error, status: status};
console.log($scope.error, config);
});
}
我已经尝试了上述方法来设置 withCredentials:false。但不恢复任何更改。它总是需要 withCredentials:true。
因此我得到错误。”'XMLHttpRequest 无法加载“API url”。对预检请求的响应未通过访问控制检查:当凭据时,不能在“Access-Control-Allow-Origin”标头中使用通配符“*”标志为真。因此不允许访问源“ http://localhost:3000 ”。”
我也尝试过在 expressjs.Using cors() 中设置 withCredentials:false。但没有变化。