Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using postman to access firebase REST API

I'm trying to use postman to do REST API calls to firebase. I've managed to read from firebase when my security rule is to permit all users including unauthorized ones.

but when I use this rule :

{"rules":{".read": "auth != null", ".write": "auth != null"}}

I get 'error' : 'permission denied' from postman. I did the request token for google's web oauth2.0 client and got the authorization_code token back.

I tried to use token in the URL and in the header, tried it with GET & POST request and still get denied.

please help. Thanks in advance

like image 744
Reno Wijoyo Avatar asked Jul 29 '16 14:07

Reno Wijoyo


2 Answers

The answers above did not work for me.

What did work for me was going to

Project Settings (top left corner gear) -> Service Accounts (far right tab) -> Database Secrets (left menu) -> Scroll down, hover over the bulltets and click Show

Use this as the auth key, i.e. .../mycollection.json?auth=HERE

like image 183
CodyBugstein Avatar answered Sep 21 '22 12:09

CodyBugstein


For me it worked like this:

https://your-database-url/users.json?auth=YOUR_AUTH_KEY

Where can you get this AUTH_KEY?

you get this key from your Project Settings -> Database -> Secret Key

like image 24
Andre Evangelista Avatar answered Sep 21 '22 12:09

Andre Evangelista