title: How to pass the authorization in ajax CORS request in Firebug?
body: <p>I am trying to making an admin request to a server that is hosted on https through ajax jquery.  Somehow the header authentication parameters are not getting passed in the request and I get a 401 error . 
      I am not able to pass the header authorization information and  I am getting 401 unauthorized error .  How do I pass the authorization in the  header? 
      Any body faced this issue before , any help would be appreciated. Thanks.</p>
  
  <p>Below is my ajax request :::: </p>
  
  <pre><code>$.ajax({
      beforeSend: function(xhrObj){
           xhrObj.setRequestHeader("Authorization","Basic YWRtaW46YWRtaW4=");
           xhrObj.setRequestHeader("Access-Control-Allow-Origin","*");
           xhrObj.setRequestHeader("Access-Control-Allow-Methods","POST, GET, OPTIONS, PUT, DELETE");
           xhrObj.setRequestHeader("Access-Control-Allow-Headers","Content-Type");
           } ,
      url: '/test.html',
      type : "POST",
      dataType : "json", 
      crossDomain: true,
      xhrFields: {
          withCredentials: true
          },
      contentType: "application/json" , 
      data: {
          'name'    : 'test123456',
          'description'   : 'test' ,
          'owner'   : 'admin' ,
          'accessRestriction'   : 'VIEW' 
          },
      cache : true, 
       success : function(service_data) {
           alert("success");
        },
       error : function(msg) {
           alert("error");
         }
   });
  </code></pre>