title: Unauthorized error 401 GCM error
body: <p><em>Note, this question should be materially different from other questions with a similar name because of the fact that the API seems to have changed significantly over the past few years.</em></p>
  
  <p>I am trying to send a push notification to an iOS device using GCM.</p>
  
  <p>I have (I think) mostly set it up correctly. I have an API key from GCM, I've setup my SSL certificate on Apple Developer and I have my device correctly getting a registration id.</p>
  
  <p>I've got a little test script written up to try to test it and I'm getting 401 unauthorized error in my result. Here's my code:</p>
  
  <pre><code>define('API_ACCESS_KEY', '&lt;API KEY HERE&gt;');
  
  $fields = array(
      'to' =&gt; '&lt;REG_ID HERE&gt;',
      'registration_ids' =&gt; '&lt;REG_ID HERE&gt;',
      'notification' =&gt; array('body' =&gt; 'test', 'title' =&gt; 'Test'),
    );
  
    $headers = array(
      'Authorization: key=' . API_ACCESS_KEY,
      'Content-Type: application/json'
    );
  
    $ch = curl_init();
  
    curl_setopt($ch, CURLOPT_URL, 'https://gcm-http.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);
  </code></pre>
  
  <p>I am currently using an unrestricted key for testing purposes:</p>
  
  <pre><code>This key is unrestricted. To prevent unauthorized use and quota theft, restrict your key. 
  Key restriction lets you specify which web sites, IP addresses, or apps can use this key.
  </code></pre>
  
  <p>As far as I know, this should white list everything, shouldn't it? There are some answers from several years back on SO about how you have to whitelist a server, but that seems to be for the old interface/setup of the API.</p>
  
  <p>What could be causing this issue?</p>