title: Angular - Set headers for every request
body: <p>I need to set some Authorization headers after the user has logged in, for every subsequent request.</p>
  
  <hr>
  
  <p>To set headers for a particular request, </p>
  
  <pre class="lang-js prettyprint-override"><code>import {Headers} from 'angular2/http';
  var headers = new Headers();
  headers.append(headerName, value);
  
  // HTTP POST using these headers
  this.http.post(url, data, {
    headers: headers
  })
  // do something with the response
  </code></pre>
  
  <p><a href="https://auth0.com/blog/2015/10/15/angular-2-series-part-3-using-http/" rel="noreferrer">Reference</a></p>
  
  <p>But it would be not be feasible to manually set request headers for every request in this way. </p>
  
  <p>How do I set the headers set once the user has logged in, and also remove those headers on logout?</p>