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');
}
);
}