title: Integrate firebase auth with google app engine cloud endpoints
body: <p>Can someone specify (with some sample code) how to verify the firebase token in an google cloud endpoint? The recently asked question does not clarifiy it at all (<a href="https://stackoverflow.com/questions/37330997/how-to-integrate-firebase-authentication-with-google-app-engine-endpoints">How to integrate firebase authentication with google app engine endpoints</a>)</p>
  
  <p>Google Authentication in endpoint is done automatically by adding the User Parameter to an endpoint. 
  Facebook Tokens can be verified in an cloud endpoint with the facebook graph api like this:</p>
  
  <pre><code>    @ApiMethod(name = "endpoint.addUser", httpMethod = HttpMethod.POST)
          public ResultObject addUser(HttpServletRequest request, User pUser) throws OAuthRequestException {
      String token = request.getHeader("Authorization");
      String graphUrl  = "https://graph.facebook.com/v2.6/me?fields=id,name,email&amp;access_token=" + token;
  
      URL u = new URL(g);
      URLConnection c = u.openConnection();
      BufferedReader in = new BufferedReader(new InputStreamReader(c.getInputStream()));
      String inputLine;
      StringBuffer b = new StringBuffer();
      while ((inputLine = in.readLine()) != null){
               b.append(inputLine + "\n");            
      }
      in.close();
      graph = b.toString();
      JSONObject json = new JSONObject(graph);
  
      facebookId = json.getString("id");
      email = json.getString("email");
      //...
  }
  </code></pre>
  
  <p>Is the verification of the firebase token as easy as the facebook token? Is it possible to retrieve the email from an firebase token?</p>