hello,
I need to read the contents from a url like
example.com/someAPIUrl/participant/info
This is my code,
var BodegaManager = (function() {
function BodegaManager() {
}
BodegaManager.prototype.connect = function(req, res, func1, func2) {
var get = http.get(func1(req, res), function(remoteRes) {
console.log("Got response: " + res.statusCode);
remoteRes.on('data', function(chunk) {
func2(req, res, chunk);
})
}).on('error', function(e) {
console.log("Got error: " + e.message);
});
return get;
}
BodegaManager.prototype.loginInfo = function(req, res){
this.connect(req, res, loginRequest.requestUrl2,
loginRequest.communicate2);
}
return BodegaManager;
})();
//logininfo
var communicate2 = function(req, res, remoteRes) {
var reply = JSON.parse(remoteRes.toString('utf8'), 'utf8');
console.log(reply);
res.redirect('login/confirm');
}
var requestUrl2 = function(req, res) {
var options = option('participant/info');
options.headers = {
'Authorization': 'Basic ' + new Buffer(req.session.username + ':' +
req.session.password).toString('base64')
}
console.log(req.session.username + req.session.password);
return options;
}
The issue is that my request isn't authenticated
Thanks in advance
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en