title: Error 401 (Unauthorized) When making REST calls using Axios with JWT headers included
body: <p>I'm developing a small react node application with JWT passport for authentication. I've tested all the endpoint through postman(by passing token with authorization header) and they are working properly.</p>
  
  <p>This is the call im making from the front-end</p>
  
  <pre><code>export const getUsersDetails=()=&gt;{
    console.log( localStorage.getItem('jwtToken'));
    return (dispatch) =&gt; {
      return axios.get('http://localhost:3030/users',
               { headers: { 'Authorization': localStorage.getItem('jwtToken') } }
              ).then((data)=&gt;{
                   console.log('data comming',data);
                  dispatch(getUsersData(data));
              }).catch((error)=&gt;{
                console.log('error comming',error);
                  dispatch(errorgetUsersData(error));
              });
          };
  }
  </code></pre>
  
  <p>I have enable CORS by using the the CORS module. this is the how the network calls looks like from the browser
  <a href="https://i.stack.imgur.com/sufj1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sufj1.png" alt="enter image description here"></a></p>
  
  <p>the authorization header looks like<br>
  <strong><code>authorization:[object Object], eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....</code></strong></p>
  
  <p>Should this be like <strong><code>authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.....</code></strong>
  Is this the reason why im facing this issue? How to overcome this?</p>