Possible to add http basic auth headers or settings?
Is it possible to add http basic auth headers to request?
+1
This worked for me: See http://www.webtoolkit.info/javascript-base64.html#.UwCSKEJdVcg for Base64 code.
ph.createPage(function(err,page) { var authentication_data = {"Authorization": "Basic " + Base64.encode("my_domain:my_password")}; page.set('customHeaders', authentication_data, function(err){ // do something now }); });
btoa was not working for me so I resorted to the Base64 example.
Used a slightly different approach but this works:
return ph.createPage(function(err,page) { var authentication_data = {"Authorization": "Basic " + new Buffer("name:pass").toString('base64')}; page.set('customHeaders', authentication_data, function(err){ //... access htauth page here }); });