Hi, I'm really struggling to get the authenication header to work, to access my azure devops. I've tested the path and the Personal Access Token (PAT) with powershell. Everything works.
I just cannot get the same to work in javascript/jquery. Please see my code below. I've put down two different ways I've tried and commented it them out. would really appreciate the help.
// var username = "username";
// var password = "54--PAT-TOKEN--xq";
var vstsAuthHeader = { "Authorization": "Basic " + btoa("" + ":" + "54--PAT-TOKEN----xq") }
//xhr.setRequestHeader('Authorization', "Basic "+ btoa(username + ':' + password));
xhr.setRequestHeader(vstsAuthHeader);
},
success: function(data){
if (data.success) {
alert("Oh yes!");
}
else{
alert("Oops, an error occurred fetching the remote data.");
}
}
});
Thanks
Russ