Search code examples
swiftfirebasefirebase-authenticationfirebaseui

How do I bypass the welcome screen UI and present only the phone auth UI screen in Firebase Auth?


How can I present the viewController which is responsible for collecting phone number data in FirebaseUI rather than the welcome screen?

With the current set up I am presented with a Welcome screen.

   class Login: UIViewController, FUIAuthDelegate {
    let authUI = FUIAuth.defaultAuthUI()

     override func viewDidAppear(_ animated: Bool) {


    let phoneProvider = FUIPhoneAuth(authUI: authUI!)
    authUI!.isSignInWithEmailHidden = true
    authUI!.providers = [phoneProvider]
    let vc = authUI?.authViewController()

    self.present(vc!, animated: true, completion: nil)
     }
 }

EDIT Thanks to proxpero I can present the phone UI like this:

class Login: UIViewController, FUIAuthDelegate {
    let authUI = FUIAuth.defaultAuthUI()

   override func viewDidAppear(_ animated: Bool) {

    authUI?.delegate = self
    let phoneProvider = FUIPhoneAuth(authUI: authUI!)
    authUI!.isSignInWithEmailHidden = true
    authUI!.providers = [phoneProvider]
    phoneProvider.signIn(withPresenting: self, phoneNumber: nil)
     }
 }

enter image description here enter image description here


Solution

  • If you want to bypass the welcome screen, and present the phone auth screen straightaway, I think that instead of self.present(vc!, animated: true, completion: nil), put phoneProvider.signIn(withPresenting: self, phoneNumber: nil).

    This method on phoneProvider creates the phone auth ui view controller and presents it on the parent view controller that you pass in (self in this case).