This isn’t accessing analytics, it’s accessing Firebase. I just had some working code from Analytics that I used as a starting point.
Anyway, I figured it out. The trick is that I needed to create a new service account private key over on the Firebase side, download client secrets from there, and then use those secrets in the authenticated calls to firebase. -Joshua > On Jan 14, 2020, at 1:16 PM, 'Pierre-Yves Blain' via Google App Engine > <[email protected]> wrote: > > Is the Analytics API enabled? Also, was the service account email address > used to add a user to the analytics account you want to access via the API? > You can follow this detailed quickstart documentation [1] with explicit steps > to accomplish the authorization. > > [1] > https://developers.google.com/analytics/devguides/config/mgmt/v3/quickstart/service-py > > On Friday, January 10, 2020 at 4:09:23 PM UTC-5, Joshua Smith wrote: > And a related issue. I have some code that this app successfully uses to > connect to the google analytics API. I tweaked that code for firebase as > follows: > > from oauth2client.service_account import ServiceAccountCredentials > from httplib2 import Http > credentials = ServiceAccountCredentials.from_json_keyfile_name( > CLIENT_SECRETS, > scopes=['https://www.googleapis.com/auth/firebase.database', > 'https://www.googleapis.com/auth/userinfo.email > <https://www.googleapis.com/auth/firebase.database',+'https://www.googleapis.com/auth/userinfo.email>']) > http = Http() > http_auth = credentials.authorize(http) > > But that gives 401 errors. I would guess that I need to enabled an API on the > console, but I can’t figure out which one to enable. I enabled “Firebase > Storage” but that didn’t help. > > What API do I need to enable to get that scope authorized? > > -Joshua > >> On Jan 10, 2020, at 3:19 PM, Joshua Smith <[email protected] >> <mailto:[email protected]>> wrote: >> >> This looks very promising, and I’m playing with it now. Getting the >> permissions set up is hard, though. >> >> At first, I simply tried to create a firebase project associated with the >> GAE project that’s going to dump data there. I was able to do that, but it >> won’t let me create a realtime database because my GAE project has a >> database of its own. >> >> So then I tried creating a brand new thing. And that works, except I can’t >> figure out how to give my GAE project permission to read/write to it. If I >> try to add it’s “@appspot.gserviceaccount.com >> <http://appspot.gserviceaccount.com/>” email as a User with Editor >> permission, it just gives an error. >> >> Any idea how I can give my GAE project permission to authenticate against a >> different Firebase project? >> >> -Joshua >> >>> On Jan 10, 2020, at 9:51 AM, 'Olu' via Google App Engine >>> <[email protected] >>> <mailto:[email protected]>> wrote: >>> >>> I think using Firebase Realtime Database to send real-time updates might be >>> applicable in your setup and it works well with App Engine(Standard). I >>> suggest you go through this doc[1]. >>> >>> [1]https://cloud.google.com/solutions/using-firebase-real-time-events-app-engine >>> >>> <https://cloud.google.com/solutions/using-firebase-real-time-events-app-engine> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Google App Engine" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to [email protected] >>> <mailto:[email protected]>. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/google-appengine/602eb9d0-d46f-45cd-91dd-a59eddd0ef88%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/google-appengine/602eb9d0-d46f-45cd-91dd-a59eddd0ef88%40googlegroups.com?utm_medium=email&utm_source=footer>. >> > > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-appengine/936d054a-fb51-4fbf-b379-52692a8c1f8c%40googlegroups.com > > <https://groups.google.com/d/msgid/google-appengine/936d054a-fb51-4fbf-b379-52692a8c1f8c%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/6ECCCA7F-D116-4E03-AC1C-585CC3248856%40gmail.com.
