This question already has answers here:
Assigning roles to members in Firebase project
(2 answers)
Closed 4 years ago.
How to give roles to user in firebase for my android app??
I want to differentiate employee and manager login.
Thanks in advance.
Just you have to add a role node in the firebase database saving the user's unique id like uid seprated by it their role.
"role" : {
"uid_1" : "emp",
"uid_2" : "manger" }
Related
This question already has answers here:
Check if value in Firebase Realtime Database is equal to String [duplicate]
(2 answers)
Closed 2 years ago.
I'm working on a Doctor-on-Demand kind of application and I want to use firebase for the project. I have 3 types of users and Apps:
Patients
Doctors
Admin
What are workaround on this, for example for the case of authentication each have their own custom fields.
Its not clear why you want to use firebase and for what purpose. I mean how you want to use firebase here. Please give some more detail about it.
Set the value like is_admin == 1 and is_doctors == 2 and is_patients == 3 and please give some more detail about it.
This question already has answers here:
How to get userID by user Email Firebase android?
(6 answers)
Closed 5 years ago.
I am trying to know if a user exists in Firebase (Email/Password Authentication) y only knowing the display name.
I am doing this is Android (Java).
Thank you so much!
There is no built-in support in Firebase Authentication to look up users by their display name. Given the loose definition of the meaning of the display name, it would be of limited use. Display names can't be required to be unique, since it's just a value that says how the user wants to be addressed: "When you show something from/to me, show this name next to it".
Many developers end up allowing their users to pick a username/nickname, which they then do require to be unique. If that approach make sense for your use-case too, I recommend reading some of these questions about how to accomplish this with the use of the Firebase Realtime Database:
Firebase android : make username unique
Enforcing unique usernames with Firebase simplelogin
Firebase query if child of child contains a value (a more general explanation of uniqueness in the Firebase Realtime Database)
How do you prevent duplicate user properties in Firebase?
This question already has answers here:
Firebase android : make username unique
(4 answers)
Closed 5 years ago.
The problem I can't seem to find a straight answer to is how can I do a query on this list in the Firebase database by some field (a username in my case) to find the associated key for that user given that username is guaranteed to be a unique value.
I've read through the documentation on queries, but it looks like all of them need a key in some shape or form is that really the case? And if it is how is this normally avoided?
Thanks a million below is how my DB is designed.
Right now, in my database there is a list of user objects:
Database
-users
-{SomeUniqueKey}
-data: "some data"
-username: "user1"
-usernameThisUserIsFollowing: "user2"
+{SomeOtherUniqueKey}
You may use equalTo.
Reference: https://firebase.google.com/docs/database/
This question already has answers here:
How do I return a list of users if I use the Firebase simple username & password authentication
(7 answers)
Closed 6 years ago.
I am storing user's display name in Firebase Auth. Fetching from Firebase Auth is simple when the same user is logged in. But, when another user is logged in, how do I fetch an account's display name when I have their unique UID (User ID).
One solution is when you register a user add his details in database also
Example
Once you are under createUserWithEmailandPassword()
DatabaseReference db=FirebaseDatabase.getInstance().getReference();
DatabaseReference users = db.child("Users").child(mAuth.getCurrentUser().getUid());
users.child("Name").setValue("<NAME>");
Now when the user signs into your database retrieve the Name from the database from child Users
You can't get the name, or any other details of a user that is not currently signed in using FirebaseAuth.
Instead, you must create a node in your database where you store the name, and any other necessary details by querying the database.
I'm really curious to know how you have the UID of any other user without doing this.
This question already has answers here:
How do I return a list of users if I use the Firebase simple username & password authentication
(7 answers)
Closed 5 years ago.
How can I retrieve the list of users from Firebase Authentication? I can get the 'current' user but that's it. Or do I have to add users to database first and get the list from there?
If you have a nodejs project, use the firebase auth:export to export users from Firebase Auth. Users can be exported in csv or json format:
firebase auth:export users.json --format=json --project projectname
It's not possible to retrieve a list of users from Firebase Authentication.
The explanation is in this thread
The only way to do that is to save the user to the database once they are registered.