title: Angular 9 Access to XMLHttpRequest at 'xxxxxx.net/api' from origin 'http://localhost:4200' hase been blocked by policy
body: <p>I would like to use the function <code>userAPI()</code> to display the content of the api but it doesn't work even though I used Access-Control-Allow-Origin.</p>
  
  <pre class="lang-js prettyprint-override"><code>this.service.userAPI().subscribe(data =&gt; console.log(data));
  
      httpOptions = {
       myHeaders : new HttpHeaders( { 
      'Access-Control-Allow-Origin' :'https://xxxxxxxx.net/api/expenseItems',
      'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
      'Access-Control-Allow-Headers': 'myHeaders, X-Requested-With, Content-Type, Origin, Authorization, 
       Accept, Client-Security-Token, Accept-Encoding',
      'Content-Type': 'application/json',
      'Authorization': 'Bearer Tokenxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    })
  }
  
      requestOptions = {
      method: 'GET',
      headers: this.httpOptions.myHeaders,
      redirect: 'follow'
  };
      userAPI():Observable&lt;any&gt;{
      return this.httpClient.get('https://xxxxxxxxxxx.net/api/expenseItems', this.requestOptions)
  }
  </code></pre>