I've tried every example I've seen on stackoverflow and I still cannot get jquery to include the authorization. I am user jQuery 1.11.3. Here is my ajax call
var headers = "Basic "+username+":"+password;
var data = $.ajax({
type: "GET",
url: "https://55.55.55.55:6025/users",
crossDomain: true,
dataType: 'jsonp',
beforeSend : function(xhr) {
xhr.setRequestHeader("Authorization", headers);
},
xhrFields: {
withCredentials: 'true'
},
processData: 'false'
})
data.done(function (result) {
console.log(result);
})
data.fail(function (result) {
console.log(result);
});
I have also tried this:
var data = $.ajax({
type: "GET",
url: "https://104.236.169.12:6025/users",
crossDomain: true,
dataType: 'jsonp',
username: creds[0],
password: creds[1]
})
Why is this not including an authorization field in the request headers?
I am also using limejs. So if there is some kind of CORS functionality inside that that I am not getting, would someone please point that out?
EDIT
I found this method that seems to be working:
var data = $.ajax({
type: "GET",
url: "https://user@email.edu:pass@104.236.169.12:6025/users",
dataType: 'jsonp'
})
but it sends the credentials in plain text in the http request. Is this a safe method?