Pregunta

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();
}
¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top