0

In my firestore database, i created phonenumber and passwords so, i can check if the phonenumber and password when the user tries to login, then i can get the userid which is the name of the document, store the userid in a provider and pass it to the required pages. what is want to know is, is there a better way to do this, i would like to somehow have the access to the built in firebase auth functions.

Here is the image of what my firestore database looks like:

enter image description here

mbakabilal
  • 189
  • 2
  • 12
  • 1
    You can create users in Firebase Auth itself directly? That'll be more secure as well.. – Dharmaraj Sep 27 '21 at 10:13
  • i don't understand what you mean by create user in Firebase Auth, do you have a link to something i could read, or what should i read up on so i can learn to do that?. – mbakabilal Sep 27 '21 at 10:16
  • Are you using [Firebase Authentication](https://firebase.google.com/products/auth), a service dedicated for authenticating users? – Dharmaraj Sep 27 '21 at 10:17
  • yes, i used it to signup the users, with phonenumber. – mbakabilal Sep 27 '21 at 10:19
  • Did you use [`signInWithPhoneNumber`](https://firebase.flutter.dev/docs/auth/phone#web-signinwithphonenumber) ? You use the same method to login users as well. If an account with that number exists, it'll be login otherwise a new account will be created. – Dharmaraj Sep 27 '21 at 10:21
  • Yes i used the mobile version verifyPhoneNumber to signup the user, i could use the same thing to login the user, but i don't want the user to recieve otp, i just want to be able to sign in with my phone number and password, that has already been confirmed while signinup. – mbakabilal Sep 27 '21 at 11:16

1 Answers1

0

Please check the Firebase Authentication docs. https://firebase.google.com/docs/auth

You can create users and access their id's using FirebaseAuth class.

A. Sahin
  • 51
  • 3