skip to Main Content

I have a communications app between 2 people regarding children that uses Firebase to authenticate its users. I need to allow new users to come to register for my app, where they fill out their email, a password, a confirmation password, and the email of the user they want to be paired with (In this case, a coparent).

How do I set up my Firebase to allow me to pair these 2 users, have their own login information, and then have them pull from the same space in the database within Firebase to store these folk’s conversations, messages within conversations, etc.?

An idea I have for how the data model could look is that they both perform a get to the same ID they both get. Let’s call it their pairID. Each user has their own GUID to identify who’s who and get their own private information (such as a private journal only they see), but they’ll have the pairID where they GET their list of conversations that have messages within them (Think of multiple chat threads with 1 person), and their shared docs/pics/requests, etc.

I know that this is the hardest part of my app right here, so once I can configure Firebase to accept pairing 2 users in there, I can move forward and just keep making the DB model for how their data should look grow as I add more features.

Thus far I’ve tried to log in as a single user, but that won’t be useful to me until I can figure out how to pair them within Firebase.

2

Answers


  1. You’ll have to store the user connection you want to make in a separate way (for example firestore) since the only key/value pairs you can add in firebase authentication are custom token fields (on which you cannot filter users in the admin sdk).

    Login or Signup to reply.
  2. An idea I have for how the data model could look is that they both perform a get to the same ID they both get.

    There is no way in which two separate users who authenticate to Firebase can get the exact same UIDs. Besides that, as also @FrankvanPuffelen mentioned in his comment, there is nothing already built that can help you create a relationship between your users. There is no pairing mechanism present. Firebase Authentication is designed to authenticate users and not to pair them.

    If you need such a mechanism, then you have to create that yourself. So you can isolate two users for example and add them to a group. There are many examples out there, but the most important thing is to enforce the rights using Firestore security rules, so only those two users are allowed to do the kind of things you need.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search