Malay Agrawal
Malay Agrawal

Reputation: 57

Access Firebase Realtime Database using Pyrebase

I have recently started with pyrebase and I am having trouble in storing data depending on user and receiving it. After completing the authentication part I create a user ID as user['idToken'] And then pushed data by using

archer = {"name": "Sterling Archer", "agency": "Figgis Agency"} 
db.child("agents").push(archer, user['idToken'])

I assume that each user has different ID token which remains same even if we logout and relogin. but when I am using

all_agents = db.child("agents").get(user['idToken']).val()
print(all_agentes)

It's printing all data stored in realtime database. Even which were stored by other users.

I tried reading all it's documentation, but I was unable to understand how to handle it.

What's wrong that I am doing in here and How can I correct it?

Upvotes: 0

Views: 529

Answers (1)

Malay Agrawal
Malay Agrawal

Reputation: 57

Use user[localId] instead of user[idToken] as it will create database for every different user separately

Upvotes: 0

Related Questions