1

Let's say I have a register activity that has these inputs:

  • Full name
  • Email
  • Phone number
  • Password

After the appropriate entry is written in a SQL table, then registration is successfully done. Also, an entry is added into Firebase Authentication (the enabled providers are email/password and phone number) like this: enter image description here

But at the login activity, you only have 2 inputs: phone number and password. Is there an easy way to determine if a phone number is already signed in?

Firebase documentation only provides a sample using email and password, like this:

mAuth.signInWithEmailAndPassword(email, password)
        .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
  
        });
Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
anta40
  • 6,511
  • 7
  • 46
  • 73

1 Answers1

1

Is there an easy way to determine if a phone number is already signed in?

Yes, there is. The simplest solution would be to store user data either in Cloud Firestore or in the Realtime Database, and check that of existence as explained in my answer from the following post:

Or:

You can check, UID of the user or the email address.

If you already have a SQL database, then you should perform a query to check if that particular user already exists there.

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193