title: GCM http 401 authorization error
body: <p>When my backend server sends post requests to GCM servers I get an authorization error HTTP 401.</p>
  
  <p>I followed the steps described here:</p>
  
  <p><a href="http://developer.android.com/google/gcm/http.html#auth_error">http://developer.android.com/google/gcm/http.html#auth_error</a></p>
  
  <pre><code>&gt;&gt; api_key=AIzaSyDEy3...
  
  &gt;&gt; curl --header "Authorization: key=$api_key" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send  -d "{\"registration_id\":\"ABC\"}"
  </code></pre>
  
  <p>I get this:</p>
  
  <pre><code>&lt;HTML&gt;
  &lt;HEAD&gt;
  &lt;TITLE&gt;Unauthorized&lt;/TITLE&gt;
  &lt;/HEAD&gt;
  &lt;BODY BGCOLOR="#FFFFFF" TEXT="#000000"&gt;
  &lt;H1&gt;Unauthorized&lt;/H1&gt;
  &lt;H2&gt;Error 401&lt;/H2&gt;
  &lt;/BODY&gt;
  &lt;/HTML&gt;
  </code></pre>
  
  <p>In the troubleshooting it says:</p>
  
  <pre><code>Authentication Error
  The sender account that you're trying to use to send a message couldn't be authenticated. Possible causes are:
      1. Authorization header missing or with invalid syntax.
      2. Invalid project number sent as key.
      3. Key valid but with GCM service disabled.
      4. Request originated from a server not whitelisted in the Server Key IPs.
  </code></pre>
  
  <p>I have questions about that:</p>
  
  <ol>
  <li>Is the header in the curl request correct?</li>
  <li>Do they mean "api_key" (AIzaSy…) or the Project number like 8305134….?</li>
  <li>How do I whitelist my Server Key IP?</li>
  <li>If I'm running the curl command, do I have to whitelist the IP-Address of my computer?</li>
  </ol>