title: get authorization header token with node js
body: <p>I would like to get token in backend node js.</p>
  
  <p>First, I get the token from jwt and I stored in localstorage,but when i would like to send a request with this token, I can't get it in server side.</p>
  
  <p><strong>Client side:</strong></p>
  
  <pre><code>        function list_users(){
              url= "http://localhost:8181/users";
              var tok = window.localStorage.getItem('token');
              if (tok) {
          /*
          $.ajaxSetup({
                      headers: {
                          'x-access-token': tok
                      }
                  });
          */
  
                  $.ajax({
                  headers: {'Authorization': tok},
                  dataType: "application/json; charset=utf-8",
                  url,
                  type: 'GET',
                  dataType: 'json',
                  success: function (json) {
      alert("done");
      }
  })
  }
  }
  </code></pre>
  
  <p><strong>Server side:</strong></p>
  
  <pre><code>router.use(function(req, res, next) {
  
  res.header("Access-Control-Allow-Origin", "*");
  res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');  
  res.header("Access-Control-Allow-Headers", "Authorization");
  
  console.log(req.headers['authorization']);
  ...
  
  }
  </code></pre>
  
  <p>But </p>
  
  <blockquote>
    <p>req.headers['authorization']</p>
  </blockquote>
  
  <p>print </p>
  
  <blockquote>
    <p>"undefined"</p>
  </blockquote>
  
  <p>Any solution please.</p>