title: HttpClient Angular POST fails with Google FCM Server, how do I fix?
body: <p>I am able to successfully send FCM messages via a POST and HTTP v1 Firebase API to my app using Postman but when I use the same POST in Angular HttpRequest it fails:</p>
  <p><a href="https://i.stack.imgur.com/cCwQz.png" rel="nofollow noreferrer">Error</a></p>
  <p>Here are my imports:</p>
  <pre><code>import { Injectable } from '@angular/core';
  import { HttpClient , HttpResponse, HttpHeaders} from '@angular/common/http';
  import { Observable } from 'rxjs';
  import { map } from &quot;rxjs/operators&quot;;
  </code></pre>
  <p>Here is my code in the service:</p>
  <pre><code>sendFCMMessage(accessToken : string, data: object) {
  console.log('sendFCMMessage');
  console.log(accessToken);
  console.log(data);
  
  const authString : string = 'Bearer '+ accessToken;
  console.log(authString);
  const url = 'https://fcm.googleapis.com/v1/projects/***-notifications/messages:send';
  const httpOptions = { headers: new HttpHeaders({
    'Content-Type':  'application/json',
    'Authorization': authString
  })};
  
  const body =
      {
      &quot;message&quot;:{
    &quot;token&quot;:&quot;wwrwjeriwe8***&quot;,
    &quot;notification&quot;:{
      &quot;body&quot;:&quot;The Knicks are winning!&quot;,
      &quot;title&quot;:&quot;Sports App&quot;
      }
     }
  };
  
  return this.http.post(url,body,httpOptions).pipe(map(res =&gt; res));
  }
  </code></pre>
  <p>I then subscribe to the response and get the error pasted above. Does anyone know why I am getting this error and how to fix? I am able to send FCM messages perfectly in Postman using the same exact POST  url, body and header.</p>
  <p>Thanks</p>