I am trying to authenticate with ruby to firebase as Service Account. So what I did so far, is using 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 the 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'
Like they say in https://firebase.google.com/docs/reference/rest/database/user-auth#section-get
and I get:
Permission denied (that is because in our DB 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 am I supposed to authenticate to Firebase WITHOUT nodejs... just a simple REST???
Please assist!
Thanks!