Reputation: 1
I am using REST API in my vuejs app to access firebase realtime database, I authenticate users using Google provider and get access token. Whe I try fetching data using access_token https://rtdb-url/uid/products.json?access_token=[access token] user get 401 error. But if the user was added to "Users and permissions" in project settings it works.
Rule appplied to RTDB
{
"rules": {
"$uid": {
"products": {
".write": "auth != null && $uid === auth.uid",
".read": "auth != null && $uid === auth.uid"
}
}
Upvotes: 0
Views: 179
Reputation: 1
Apparently, I just needed to use the access token I got and send it to the following endpoint in the POST body:
https://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp?key=
As described in the documentation.
Upvotes: 0