title: Public API access not working with gapi.client for datastore javascript API
body: <p>I am new to google cloud datastore. I am currently trying to query my dataset using the API key which I created at developers console. Below is my code snippet to call the datastore API (I am using gapi.client):</p>
  
  <pre><code>gapi.client.setApiKey('API_KEY');
  gapi.client.load('datastore', 'v1beta2').then(function() { 
      console.log('loaded.'); 
      gapi.client.datastore.datasets.runQuery({'datasetId' : 'myProjectId','gqlQuery': {  'queryString': 'select * from locationReport'}}).then(function(resp) {
              console.log(resp.result);
          }, function(reason) {
              console.log('Error: ' + reason.result.error.message);}
          );
  });
  </code></pre>
  
  <p>This returns me following response:</p>
  
  <p>Response headers:</p>
  
  <pre class="lang-none prettyprint-override"><code>HTTP/1.1 401 Unauthorized
  Vary: Origin
  Vary: X-Origin
  WWW-Authenticate: Bearer realm="https://accounts.google.com/"
  Content-Type: text/html; charset=UTF-8
  Content-Encoding: gzip
  Date: Mon, 22 Jun 2015 14:49:06 GMT
  Expires: Mon, 22 Jun 2015 14:49:06 GMT
  Cache-Control: private, max-age=0
  X-Content-Type-Options: nosniff
  X-Frame-Options: SAMEORIGIN
  X-XSS-Protection: 1; mode=block
  Server: GSE
  Alternate-Protocol: 443:quic,p=1
  Transfer-Encoding: chunked
  </code></pre>
  
  <p>Response body:</p>
  
  <blockquote>
    <p>Login Required</p>
  </blockquote>
  
  <p>Though it is mentioned <a href="https://developers.google.com/api-client-library/javascript/dev/dev_jscript" rel="nofollow noreferrer">here</a> that one can access the data using public api, I am still not able to do so.</p>
  
  <p>Please help me with this. Let me know whether is it possible or is there any other way to retrieve data from datastore without requiring user permission like OAuth</p>