This question is locked. New answers and comments are not allowed.
Hi,
So I've got a bit of a problem setting authorization headers in my request to a webservice from my appbuilder app. I don't think it's a cors issue because it's working fine except I can't seem to set any headers in the request. both of these work when calling from an html page and the headers a set correctly but the headers are empty from the mist emulator.
So just trying to set the headers like this doesn't seem to set them
$.ajax({
url: 'http://myapp.com/api/scheduledworkouts',
headers: {
"Authorization":"Basic " + btoa($('#username').val() + ":" + $('#password').val())
}
});
This doesn't work either
$.ajax({
url: 'http://myapp.com/api/scheduledworkouts',
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization",
"Basic " + btoa($('#username').val() + ":" + $('#password').val()));
}
});
So I've got a bit of a problem setting authorization headers in my request to a webservice from my appbuilder app. I don't think it's a cors issue because it's working fine except I can't seem to set any headers in the request. both of these work when calling from an html page and the headers a set correctly but the headers are empty from the mist emulator.
So just trying to set the headers like this doesn't seem to set them
$.ajax({
url: 'http://myapp.com/api/scheduledworkouts',
headers: {
"Authorization":"Basic " + btoa($('#username').val() + ":" + $('#password').val())
}
});
This doesn't work either
$.ajax({
url: 'http://myapp.com/api/scheduledworkouts',
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization",
"Basic " + btoa($('#username').val() + ":" + $('#password').val()));
}
});