title: Google Cloud Datastore gives 401 error response code
body: <p>I want to build a simple rest API using Google Cloud Datastore and I can't access my data</p>
  
  <p>First, I am new with Google Cloud Platform but this is not going to stop me until I find a solution on how to make a rest API call with Google Cloud Datastore.</p>
  
  <p>I use Angular 4 in as front end and I want to make a simple HTTP request.</p>
  
  <h1>This is my data in Google Cloud Datastore</h1>
  
  <p><a href="https://i.stack.imgur.com/WvvmV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WvvmV.png" alt="enter image description here"></a></p>
  
  <h1>This is my api.service.ts</h1>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { Http, Response } from '@angular/http';
  import 'rxjs/add/operator/map';
  
  
  
  
  @Injectable()
  export class ApiService {
  
    private apiUrl1 = 'https://jsonplaceholder.typicode.com/posts';
    private apiUrl2= 'https://datastore.googleapis.com/v1/projects/project-test:runQuery?key=dsdsdsdsdsdsdsdsdsdsdsds';
  
    data: any = {};
  
    constructor(
      private http: Http
    ) { }
  
    getData1() {
      return this.http.get(this.apiUrl1)
      .map((res: Response) =&gt; res.json());  &lt;====== this works
    }
  
    getData2() {
      const body = {
        "query": {}
      };
  
      return this.http.post(this.apiUrl2, body)
      .map((res: Response) =&gt; res.json()); &lt;====== this dont works
    }
  
  }
  </code></pre>
  
  <h1>I have this error</h1>
  
  <blockquote>
    <p>POST
    <a href="https://datastore.googleapis.com/v1/projects/project-test:runQuery?key=1b169abfa8b87ewewqewewqewqewqewqewqe" rel="nofollow noreferrer">https://datastore.googleapis.com/v1/projects/project-test:runQuery?key=1b169abfa8b87ewewqewewqewqewqewqewqe</a>
    401 ()</p>
  </blockquote>
  
  <p>Plese some expert tell me if I can access Google cloud datastore with rest API
  If yes why I have error 401 and why I need OAuth2 </p>
  
  <blockquote>
    <p>"message": "Request is missing required authentication credential.
    Expected OAuth 2 access token, login cookie or other valid
    authentication credential. See
    <a href="https://developers.google.com/identity/sign-in/web/devconsole-project" rel="nofollow noreferrer">https://developers.google.com/identity/sign-in/web/devconsole-project</a>.",↵
    "status": "UNAUTHENTICATED"↵  }↵}↵"</p>
  </blockquote>
  
  <p>How the users can access my data. Some data is going to be publicly available </p>
  
  <p>Any example how to access Cloud datastore with rest API is going to help us.
  I search the entire internet there is nothing . 0 Youtube videos 
  And all documentations is with App engine . i use Firebase hosting - angular 4 and for the queries i want cloud datastore </p>