This is the code I have to make a simple GET request:
var options = { host: \'localhost\', port: 8000, path: \'/restricted\' }; request = http.g
You need to add the Authorization to the options like a header encoded with base64. Like:
var options = { host: 'localhost', port: 8000, path: '/restricted', headers: { 'Authorization': 'Basic ' + new Buffer(uname + ':' + pword).toString('base64') } };