Read data from Real time database in Servlet

28 views
Skip to first unread message

hr lumiins

unread,
Apr 2, 2018, 3:23:43 AM4/2/18
to Google App Engine
Hi All,

able to write data in firebase databse and Getting an error when read data from Servlet:

Code to Read
public HttpResponse firebaseGet(String path) throws IOException {
// Make requests auth'ed using Application Default Credentials
Credential credential = GoogleCredential.getApplicationDefault().createScoped(FIREBASE_SCOPES);
HttpRequestFactory requestFactory = httpTransport.createRequestFactory(credential);

GenericUrl url = new GenericUrl(firebaseDbUrl+path);

return requestFactory.buildGetRequest(url).execute();
}

Output:

[s~taxideals20/20180402t002617.408725620079372773].<stdout>: ERROR com.google.api.client.http.HttpResponseException: 401 <h1>Unauthorized</h1> <h2>Error 401</h2>

sample

Kenworth (Google Cloud Platform)

unread,
Apr 2, 2018, 8:30:26 PM4/2/18
to google-a...@googlegroups.com
The link you provided is using Java 7 runtime on GAE (deprecated). Did you try following the Java 8 tutorial?
Reply all
Reply to author
Forward
0 new messages