I am trying to get information from sonarQube for a widget on TFS.
But when I to get information with javascript I get an error:
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 405.
This is the code a used:
-----------------------------------------------------------------------------------
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML = this.responseText;
xhr.open("GET","local_Url/api/authentication/validate", true);
xhr.setRequestHeader("Authorization", "Basic " + btoa("[user]:[PASSWORD]"));
-----------------------------------------------------------------------------------
It doesn't work with the TOKEN in the URL. Or with setRequestHeader("Authorization", "Basic " + btoa("[TOKEN]]"));
Is there anyone who can help me?