title: How to make certified RESTful oAuth 2 backend requests to Google API
body: <p>I need to make backend oAuth 2 REST calls to the <a href="https://developers.google.com/apis-explorer/#p/prediction/v1.6/" rel="nofollow">Google Prediction API</a>, working in node.js, but I'm very confused by the documentation around making the correct oAuth call (backend so without the web flow auth flow):</p>
  
  <p>The requests look like this:</p>
  
  <pre><code>GET https://www.googleapis.com/prediction/v1.6/projects/989280437849/trainedmodels/list?maxResults=5&amp;pageToken=1&amp;key={YOUR_API_KEY}
  </code></pre>
  
  <p>With headers that look like this</p>
  
  <blockquote>
    <p>Authorization:  Bearer
    ya29.AHES6ZSyB5W2gp4GfmZIGrVHLyisJB9hCbNLW3mj5rs0Oqg
    X-JavaScript-User-Agent:  Google APIs Explorer</p>
  </blockquote>
  
  <p>The oAuth documentation is here, says I need a "Service Account": <a href="https://developers.google.com/accounts/docs/OAuth2?csw=1" rel="nofollow">https://developers.google.com/accounts/docs/OAuth2?csw=1</a></p>
  
  <p>and here <a href="https://developers.google.com/accounts/docs/OAuth2ServiceAccount" rel="nofollow">https://developers.google.com/accounts/docs/OAuth2ServiceAccount</a></p>
  
  <p>What kind of oAuth token should I set up? <a href="http://screencast.com/t/1vXjCgnyCuU2" rel="nofollow">http://screencast.com/t/1vXjCgnyCuU2</a></p>
  
  <p>I thought it was "Server key" but the docs say the prediction API needs to be logged in as a user, whereas the Server key says "Use this for accessing data <em>not</em> associated with an account from a server"</p>
  
  <p>I believe I should use the "Certificate" option <a href="http://screencast.com/t/4sL1WTjxqp" rel="nofollow">http://screencast.com/t/4sL1WTjxqp</a></p>
  
  <p>But I have no idea what to do with the certificate. And even if I were to know, I still wouldn't have an API Key (or would I?), which the REST call seems to want. Presumably I need to sign the request in some way and submit the hash in the header.</p>
  
  <p>Any help in how to do this step by step would be awesomely appreciated.</p>