title: https request basic authentication node.js
body: <p>I am really getting crazy looking for this over the web and stackoverflow.
  Other posts about this topic talk of http request, not httpS.</p>
  
  <p>I'm coding server side with node.js and I need to make an https request to another website to login</p>
  
  <p>If I use postman tool in chrome trying with <a href="https://user:pass@webstudenti.unica.it/esse3/auth/Logon.do" rel="nofollow">https://user:pass@webstudenti.unica.it/esse3/auth/Logon.do</a> everything works fine and I log in.</p>
  
  <p>If I use request library in node I can't login and I get a page with a custom error message about an error in my getting/sending data.</p>
  
  <p>Maybe I am wrong setting the options to pass to request.</p>
  
  <pre><code>var request = require('request');
  var cheerio = require('cheerio');
  var user =  'xxx';
  var pass = 'yyy';
  var options = {
      url : 'https://webstudenti.unica.it',
      path : '/esse3/auth/Logon.do',
      method : 'GET',
      port: 443,
      authorization : {
          username: user,
          password: pass
      }
  }
  
  request( options, function(err, res, html){
      if(err){
          console.log(err)
          return
      }
      console.log(html)
      var $ = cheerio.load(html)
      var c = $('head title').text();
      console.log(c);
  })
  </code></pre>
  
  <p><a href="http://jsfiddle.net/985bs0sc/1/" rel="nofollow">http://jsfiddle.net/985bs0sc/1/</a></p>