I tried to use the httpDo() with the following code for basic authentication but it is not working, can someone advise on this ?
I got a “Failed to load resource: the server responded with a status of 401 (Unauthorized)” from the server in the console."
apiMetrics = "http://somehost.com/api/v2/monitoring/metrics";
function setup() {
createCanvas(400, 400)
var url = apiMetrics;
httpDo(
url, {
method: 'GET',
headers: {
authorization: 'Basic username:password'
}
},
function (data) {
console.log(data);
}
)
}