title: Angularjs set a authorization header
body: <p>I am trying to put an authorization header in my requests but it doesn't work. </p>
  
  <p>I am using this:</p>
  
  <pre><code>var config = {headers: {
    'Authorization': token
    }
  };
  return $http.get('http://localhost:3000/apis/users/all', config);
  </code></pre>
  
  <p>And also I tried this:</p>
  
  <pre><code>$http.defaults.headers.common['Authorization'] = token;
  </code></pre>
  
  <p>But with both cases I got this headers in the back-end request:</p>
  
  <pre><code>Accept:*/*
  Accept-Encoding:gzip, deflate, sdch
  Accept-Language:es-ES,es;q=0.8,ca;q=0.6,en;q=0.4,gl;q=0.2
  Access-Control-Request-Headers:accept, authorization
  Access-Control-Request-Method:GET
  Connection:keep-alive
  Host:localhost:3000
  Origin:http://localhost:8000
  Referer:http://localhost:8000/
  User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4)         AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
  </code></pre>
  
  <p>I need something like this:</p>
  
  <pre><code>Authorization: token
  </code></pre>
  
  <p>But I got this:</p>
  
  <pre><code>Access-Control-Request-Headers:accept, authorization
  </code></pre>
  
  <p>Then, I don't have in any place the token value.</p>
  
  <p>I am using expressjs for the back-end and I using this for CORS:</p>
  
  <pre><code>app.use(function(req, res, next) {
      res.header('Access-Control-Allow-Origin', '*');
      res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization');
      next();
    });
  </code></pre>
  
  <p>Also say that testing with the chrome extension Advance Rest Client it is working fine. In the request header there is a Authorization: valueOfToken..</p>
  
  <p>Thanks a lot.</p>