curl "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token" \
-H "Metadata-Flavor: Google"
curl --verbose https://myproject.firebaseio.com/users.json -H "Authorization":"Bearer <ACCESS_TOKEN>"
< HTTP/1.1 403 Forbidden
* Server nginx is not blacklisted
< Server: nginx
< Date: Sat, 10 Sep 2016 14:09:31 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 37
< Access-Control-Allow-Origin: *
< Cache-Control: no-cache
<
{
"error" : "Permission denied."
}
5. My database rules are set as:
{
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
}
}
}
Originally I wrote it as an application in Golang, but then decided to drop down to curl to reproduce the problem. My golang application had the same problem, while using the firego and knq/firebase libs. OTOH, my local machine, I am logged in using gcloud and my golang application can access the DB successfully.
Any help is greatly appreciated as I am running out of ideas on what is causing it. I am guessing there is a config/tweak somewhere that I am not aware of.
Vivek
$ gcloud compute instances create <INSTANCE_NAME> --scopes userinfo-email,https://www.googleapis.com/auth/firebase.database