I am trying to authenticate from ruby to firebase as a service account. So what I have done so far uses Google auth lib, as I always did (in other google services):
require 'googleauth'
scopes = ["https://www.googleapis.com/auth/firebase.database"]
tt = Google::Auth.get_application_default(scopes).fetch_access_token
I get tt ["access_token"] and then I do something like
curl -X POST -d '{"user_id" : "jack", "text" : "Ahoy!"}' 'https://project-xxxxxxxxxxxxxxxxxxx.firebaseio.com/message_list.json?access_token=ya29.CjHzAsjcGEQsSppI9AKCV9g4Uen7qlREI3N_nCGDsWkLh6ZSCg5JmNYzIU8NuV6PAq7h'
As stated in https://firebase.google.com/docs/reference/rest/database/user-auth#section-get
and I get: Permission denied (this is because in our database rules we said auth! = Null. So I went ahead and called ?auth=ya29.CjHzAsjcGEQsSppI9AKCV9g4Uen7qlREI3N_nCGDsWkLh6ZSCg5JmNYzIU8NuV6PAq7h
And I got:
"{\n \"error\" : \"Could not parse auth token.\"\n}\n"
How can I go through Firebase authentication WITHOUT nodes ... just just REST ???
Please, help!
Thank!
source
share