I'm writing a node.js application that makes a get request to pingdom; but keep getting "user credential missing error" even tho I tried to put that everywhere. Please see code below.
function get_checks() {
var options = {
"hostname" : "api.pingdom.com",
"path" : "/api/2.0/checks?"+"userpwd=user@example.com"+":"+"password",
"method" : "GET",
"headers" : {
"userpwd" : "user@example.com"+":"+"password",
"App-Key" : "key"
},
"userpwd" : "user@example.com"+":"+"password"
};
var req = https.request(options, function(response){
response.on('data', function(response_data) {
console.log("Response: " + response_data);
});
});
req.end();
}
Just gonna answer this myself so it doesn't hang as an unanswered question...
pingdom uses http basic authentication so it has to be in authentication header
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.