I need to call http request cross-domain which I can consume successfully by $.ajax with code below. The request bases on Basic Authentication, it works.
$.ajax({
    type: "GET",
    url: "https://" + username + ":" + password + "@/api/systems",
    //crossDomain: true,
    dataType: 'jsonp',
    async: true
}).done(function (result) {
    $("#div1").html(JSON.stringify(result.data));
});  However, I can't get it to work in nodejs running in server. My code is as below:
var request = require('request');
var url = "https://" + username + ":" + password + "@/api/systems";
var option = {
    url: url,
    auth: {
        user: username,
        password: password
    }
};
request(option,
    function (error, response, body) {
        console.log(body);
    }
);It always returns Error 401 Unauthorized.
How can I get it in nodejs?
 
     
    