0

In Firebase, I am trying to add a way to custom sign in a user. For sake of simplicity I'll have two users for my flutter app, User 1, and User 2. User 1 decides to register an account to my app using Firebase, In this app, User 1 will be able to write data to the Realtime Database. Once User 1 is logged in, is there a way for User 1 to generate a "code", so to speak, that can allow User 2 to register by entering the it, then be able to see all the data User 1 made? In my Firebase console, all I see is various modes of sign in using social media and other platforms but no option for custom authentication. An example of code would be great but an article explaining this would also be great as I am lost on what term to lookup. -Thank you so much and I wish you have a great rest of your day!

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

1 Answers1

0

Firebase's custom authentication doesn't have any UI, since you're writing the code for it.

But I think here you may just be looking for something like Firebase anonymous authentication, which literally just generates a UID for the device that you run the code on. If you then log this UID and stuff it into your security rules, you have a decent starting point at what you're looking for.

{
  "rules": {
    ".read": true,
    ".write": "auth.uid === 'theUidForTheUserWhoCanWrite'"
  }
}

Also see:

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807