Reputation: 2332
I'm creating 2 Android applications using Java in Android Studio and Firebase as the backend.
The first app (let's call it the Doctor app means an app for doctors) has a feature of registering new users to Firebase Firestore.
The second app (let's call it the Patient app means an app for patients) has a feature of showing patient's records.
In the Doctor app, doctors can save new patient's data such as name, ID number, birth date, and gender like this picture:
If the doctor clicks the register button, the app would save the patient data into Firebase Firestore (but not register the patient into Firebase Authentication) with this configuration:
The patient's ID is programmatically generated using a random string generator.
Then the patient can sign up for the app using the Patient app using email and password in Firebase Authentication like this:
First, the patient should select his/her name from the list of users (saved by doctors) in Firebase Firestore. Then if the patient finds his/her name, the patient had to input his/her email and password. If the patient clicks the signup button, the app would create a new user to Firebase Authentication like this one:
and store the email to Firebase Firestore like this one (add the email to selected patient name):
What's the code for Patient app so the app could:
Note: if it's impossible, I would add email and password fields to the Sign Up page in the Patient app instead.
Upvotes: 0
Views: 957
Reputation: 598740
If you implement a custom identity provider you have full control over the UID that it uses.
If you want to use the built-in email+password provider, you won't have control over the UIDs it generates. The most common alternative there would be to store the custom ID you want in the user's token as a custom claim.
Upvotes: 1