title: Authentication error in Node.js
body: <p>I am trying to make a WebAPI call from server script and i am getting authentication error:</p>
  
  <p>This is how my server.js looks like:</p>
  
  <pre><code>var app = require('http').createServer()
    , io = require('socket.io').listen(app)
    , fs = require('fs')
    , moment = require('moment')
    , request = require('request'); //https://github.com/mikeal/request
  
  app.listen(8000, function () {
      console.log('server started');
      doSomethingOnServerStart();
  });
  
  
  function doSomethingOnServerStart()
  {
      console.log('Getting something from server');
  
      request.get({
          url: 'http://localhost:63213/Api/MyAPI/GetSomething',
  
      },
          function (error, response, body) {
              console.log(response.statusCode);
              if (response.statusCode == 200) {
  
                  console.log('data received from server');
  
              } else {
                  console.log('error: ' + response.statusCode);
                  console.log(body);
              }
          });
  
  }
  </code></pre>
  
  <p>I am using Mikeal's Request library to make the WebAPI call. In the HTTP Authentication section (<a href="https://github.com/mikeal/request#http-authentication" rel="nofollow">https://github.com/mikeal/request#http-authentication</a>), it says pass username and password as "hash" but does not say how do i generate that hash.</p>
  
  <p>I am kind of stuck and dont know how to proceed.</p>