RomainVialard / FirebaseApp

Google Apps Script binding for Firebase Realtime Database
Apache License 2.0
117 stars 30 forks source link

Client authentication token generated by Service Account OAuth + FirebaseApp not valid. #19

Closed CJOWood closed 5 years ago

CJOWood commented 5 years ago

I am having trouble and have narrowed down the issue to the auth token generated by .createAuthToken().

FirebaseApp.getDatabaseByUrl(fb_URL, service.getAccessToken())
                    .createAuthToken(Session.getEffectiveUser().getEmail())

When I use the Database Secret it will generate an authentication token that is usable client-side to make calls to Firebase, but for some reason an access token generated by a service account with OAuth2 doesn't make a valid authentication token.

I have also posted an issue here on StackOverflow with my code based on the tutorials mentioned in the readme.

As a side note, I love your work! It has helped me learn a lot about GAS over the years. Thank You!

CJOWood commented 5 years ago

This was all me! I updated my StackOverflow with the problem. I was trying to use an old version of the API which was mentioned in the tutorial but doesn't work.