title: Getting data from response headers in axios
body: <p>I'm making a post request using Axios and this call returns data in the response headers and body. In the headers, it's returning an <code>x-auth-token</code> and I want to get the value of this token but it returns:</p>
  
  <pre><code>undefined is not an object
  </code></pre>
  
  <p>Here is how I'm doing it:</p>
  
  <pre class="lang-js prettyprint-override"><code>axios.post('app.com/api/login', data)
    .then(response =&gt; {
      console.log(response.headers.get("x-auth-token"));
    })
    .catch(error =&gt; {
      console.log(error)
  });
  </code></pre>