Zvi Karp
Zvi Karp

Reputation: 3904

Allow users to see each other's data in firebase

Is there a why to let two user login with their own email and password and see the same data?

(Maybe one user well login and be transferred to the other user that has all the data).

Thanks, Zvi Karp

Upvotes: 0

Views: 218

Answers (1)

Brian
Brian

Reputation: 31282

What you were trying to do is about Database Design, it's actually not about Firebase. (watch out: the link is about relational database design, but Firebase is not using relational database. The idea is the same though.)

There are many ways to achieve your goal. Since you didn't describe your question clearly, I'll just give a general solution:

  1. add a key sahredData to your User entity, and the value of this key is the id of the data you want to share between users. Different users can use the same value in this field(which means they share the same data).

  2. whenever a user needs to access the shared data, use the value of sharedData, which is the id of the shared data, to access the data.

Upvotes: 1

Related Questions