title: How to retrieve a Bearer Token from an Authorization Header in JavaScript (Angular 2/4)?
body: <p>In JavaScript I have a method which authenticates to my server via an http post request successfully.</p>
  
  <p>The response data from my server is sending a JWT in an Authorization header like so:</p>
  
  <pre><code>Authorization: Bearer mytoken12345abc
  </code></pre>
  
  <p>I can retrieve the authorization header successfully from my servers response data like so for example:</p>
  
  <pre><code>let authheader = response.headers.get('Authorization');
  </code></pre>
  
  <p>But how do I parse this? Is "Bearer" a key? so something like:</p>
  
  <pre><code>let token = authheader.Bearer 
  </code></pre>
  
  <p>which obviously is not correct. What can I try next?</p>
  
  <p>In other words, is the following the best approach?</p>
  
  <pre><code>let token = response.headers.get('Authorization');
  let parsedToken = token.slice(7);
  </code></pre>