0
这是我的代码,但我得到授权(401)的错误,我已经使用CORS过滤器在服务器端,但我仍无法在打如何在angularjs中使用身份验证打休息服务?
var authdata = Base64.encode("username:password");
var data={};
var config = {
headers : {
'Content-Type': 'application/json;charset=utf-8;',
'Authorization' : 'Basic'+ authdata,
'Accept':'application/json'
}
};
function fetchAllUsers(){
ViewRecord.fetchAllUsers(REST_SERVICE_URI,data,config)
.then(
function(d) {
self.users = d;
},
function(errResponse){
console.error('Error while fetching Users');
}
);
}