【发布时间】:2015-04-30 01:45:04
【问题描述】:
当我尝试向本地 url 发出请求时,一切正常。但是,当我将 url 更改为我们的测试服务器的实际 url(以 http 为前缀)时,http auth 标头似乎已从请求中剥离。 评论的 $http... 有效。但下面的没有。 有人知道为什么会这样吗?
function OneCitizensList($scope, $http) {
var username = "user",
password = "pass";
$scope.citizen = [];
$scope.medication = [];
// $http.get('/mobile/unity/patient/?patientId=36', {
$http.get('http://something:8083/unity/medication/list?patientId=102', {
headers: {
'Authorization': "Basic " + Base64Encoder(username + ':' + password)
}
}).
success(function(data, status, headers, config) {
console.log(data);
}).
error(function(data, status, headers, config) {
console.log("Error");
});
}
【问题讨论】:
标签: angularjs restful-authentication