title: Chrome web app using firebase returns mismatchsenderid error
body: <p>I apologise as this question has been asked many times, but none of the responses have been helpful in resolving my issue.</p>
  
  <p>I am using firebase with my web app and attempting to send notifications via php or terminal curl command. Have tried both with same error:</p>
  
  <blockquote>
    <p>{"multicast_id":4984414565388562908,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}</p>
  </blockquote>
  
  <p>I am getting the API key and sender id straight from firebase from the same place. Copying and pasting, no typos. Checked about 50 times... 100% sure the sender id matches the API key as i am copying and pasting from the same screen.</p>
  
  <p><a href="https://i.stack.imgur.com/HKmDC.png" rel="nofollow"><img src="https://i.stack.imgur.com/HKmDC.png" alt="Firebase console"></a></p>
  
  <p>I am getting the endpoint from the Chrome console:</p>
  
  <p><a href="https://i.stack.imgur.com/mFPu4.png" rel="nofollow"><img src="https://i.stack.imgur.com/mFPu4.png" alt="Endpoint"></a></p>
  
  <p>Again, copied and pasted with no typos.</p>
  
  <p>My PHP file:</p>
  
  <pre><code>&lt;?php
  // API access key from Google API's Console
  define( 'API_ACCESS_KEY', '**API_KEY**' );
  $registrationIds = array('**SUBSCRIPTION_ID**');
  // prep the bundle
  $msg = array
  (
      'message'   =&gt; $_GET["message"],
      'title'     =&gt; $_GET["title"],
      'subtitle'  =&gt; $_GET["subtitle"],
      'tickerText'    =&gt; $_GET["ticker"],
      'vibrate'   =&gt; 1,
      'sound'     =&gt; 1,
      'largeIcon' =&gt; 'http://a4.mzstatic.com/au/r30/Purple4/v4/d2/8b/e4/d28be43c-9a6a-4b91-1981-a108ba5cec84/icon175x175.png',
      'smallIcon' =&gt; 'http://www.uidownload.com/files/303/56/11/small-arrow-left-fast-rewind-icon.png',
      'click_action' =&gt; 'https://aiatsis.gov.au'
  );
  $fields = array
  (
      'registration_ids'  =&gt; $registrationIds,
      'data'          =&gt; $msg
  );
  
  $headers = array
  (
      'Authorization: key=' . API_ACCESS_KEY,
      'Content-Type: application/json'
  );
  
  $ch = curl_init();
  curl_setopt( $ch,CURLOPT_URL, 'https://android.googleapis.com/gcm/send' );
  curl_setopt( $ch,CURLOPT_POST, true );
  curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
  curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
  curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
  curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
  $result = curl_exec($ch );
  curl_close( $ch );
  echo $result;
  
  ?&gt;
  </code></pre>
  
  <p>My Manifest file:</p>
  
  <pre><code>{
    "name": "Webpush",
    "gcm_sender_id": "**SENDER_ID**"
  }
  </code></pre>
  
  <p>The curl terminal command i am using is:</p>
  
  <pre><code>curl --header "Authorization: key=**API_KEY**" --header "Content-Type: application/json" https://fcm.googleapis.com/fcm/send -d "{\"registration_ids\":[\"**SUBSCRIPTION_ID**\"]}"
  </code></pre>
  
  <p>I have no idea why this is not working. I have tried:</p>
  
  <ul>
  <li>Checking the Key matches the sender id about 150 times.</li>
  <li>Deleting my firebase project and starting again with new API key and Sender ID (yes i generated a new endpoint subscription id after i did this).</li>
  <li>As mentioned, tried both php and terminal push requests.</li>
  </ul>
  
  <p>I have run out of options. And as mentioned several times already the API key matches the corresponding sender ID. I am 100% sure of this. As far as my understanding of the "MismatchSenderId" error, they are trying to tell me that the API key and sender ID do not match. They do match.</p>
  
  <ul>
  <li>The sender ID matches the API key</li>
  <li>The Subscription ID was generated using the correct sender ID</li>
  </ul>
  
  <p>Does anyone have any idea why this is happening?</p>