title: $httpProvider Authorization Headers in AngularJS
body: <p>I'm try to add a default header for the $http service, which value is an access token that will be generated after user authentification.</p>
  
  <pre><code>      .config(['$httpProvider', function($httpProvider) {
          $httpProvider.defaults.useXDomain = true;
          delete $httpProvider.defaults.headers.common['X-Requested-With'];
          $httpProvider.interceptors.push('httpRequestInterceptor');
  
    }]) 
  
   .factory('httpRequestInterceptor', function () {
            return {
              request: function (config) {
                config.headers = {
  
                  'Authorization': sessionStorage.token}
                return config;
              }
            };
          })
  </code></pre>
  
  <p>But Angular doesn't accept the header : A<code>ccess-Control-Request-He...   authorization</code>.
  I try with <code>$http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w'</code> and lot of other but nothing works.
  I tested the API with Rest Console and she accepts the header.</p>
  
  <p>The problem comes from my application ...</p>
  
  <p><strong>Response</strong></p>
  
  <pre><code>- Access-Control-Allow-Head...  Accept,Origin,Authorization,Content-Type,X-Requested-With
   - Access-Control-Allow-Meth... GET, POST, PUT, DELETE   
     Access-Control-Allow-Orig... *
   - Access-Control-Expose-Hea... Authorization Cache-Control no-store,   
     no-cache, must-revalidate, post-check=0, pre-check=0    
  </code></pre>
  
  <p><strong>Request</strong></p>
  
  <pre><code>- Accept    text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
   - Accept-Encoding  gzip, deflate
   - Accept-Language  en-us,en;q=0.5
   - **Access-Control-Request-He...   authorization**
   - Access-Control-Request-Me... GET
   - Connection   keep-alive
   - Host api.mysite.com
   - Origin   http://xxxxx.com:8080
  </code></pre>