Closed brainysmurf closed 5 years ago
You can find more info about this authentication method here: https://sites.google.com/site/scriptsexamples/new-connectors-to-google-services/firebase/tutorials/authenticate-via-oauth-2-access-token
If you removed passing the token and it succeeded it means your database is freely accessible (anyone can read and write to it), which is not advised.
I mean that the documentation has the database put in test mode, which does not need a token (and in fact fails if sent one), but then asks the user to run the script to populate the database. The Code.gs passes the token.
I just changed to locked mode in the documentation. I don't think calls with the token should fail in test mode but test mode means a warning is displayed in Firebase UI, so better to switch to locked mode as it doesn't change anything and avoid the warning.
Right I realize what I did: I was using two different accounts for the firebase database and where I was running the appscript, explaining why the token failed.
These two lines:
Following the instructions, I have no authentication setup, and when the token is passed I get an authentication error from Firebase library. However, if I remove passing the token, it succeeds.