简体   繁体   中英

Authenticate with Firebase using Phone Number iOS

I have to create a sign up phone number option in app and I am getting a little confused when it comes to phone number/verification textfield and whole interface controller. Do I have to create this on my own or firebase auth is supporting this screen as it happens in digits?

firebase docs: https://firebase.google.com/docs/auth/ios/phone-auth

You have two solutions, one would be to use their UI: https://github.com/firebase/FirebaseUI-iOS

The second one would be to create the UI on your own and just call methods mentioned in the link you shared:

  • verifyPhoneNumber (which returns the code)
  • credentialWithVerificationID (creates verification object)
  • signInWithCredential (accepts the verification object and tries to sign-in)

Basically, you want to get the user phone number in order to receive the code(most likely from a textfield). Once you successfully sent the code. transition to a view where the user can enter the code received thru sms than login the user. keep in mind the phone number format has to be something like this +countrycodeStatecodeNumber or +13051239988

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM