Saturday, November 21, 2026
HomeiOS Developmentios - how am i able to add firebase multifactor sms authentication...

ios – how am i able to add firebase multifactor sms authentication issue

[ad_1]

I’m utilizing this bundle -> https://github.com/appwise-labs/PhoneVerificationController,
I wish to use firebase’s secondary authentication operate, however I do not know modify the code. Are you able to give me some pointers? Thanks very a lot.

That is the unique code, how can I modify it

@IBAction func startVerification() {
        let configuration = Configuration(requestCode: { cellphone, completion in
            PhoneAuthProvider.supplier().verifyPhoneNumber(cellphone, uiDelegate: nil, completion: completion)
        }, signIn: { verificationID, verificationCode, completion in
            let credential = PhoneAuthProvider.supplier().credential(withVerificationID: verificationID, verificationCode: verificationCode)
            Auth.auth().signIn(with: credential) { _, error in completion(error) }
        })
        let vc = PhoneVerificationController(configuration: configuration)
        vc.delegate = self
        current(vc, animated: true)
    }
}


That is the instance given by firebase, I’m a novice and ask the trainer to show

let person = Auth.auth().currentUser
    person?.multiFactor.getSessionWithCompletion({ (session, error) in
      // Ship SMS verification code.
      PhoneAuthProvider.supplier().verifyPhoneNumber(
        phoneNumber,
        uiDelegate: nil,
        multiFactorSession: session) { (verificationId, error) in
          // verificationId can be wanted for enrollment completion.
          // Ask person for the verification code.
          let credential = PhoneAuthProvider.supplier().credential(
            withVerificationID: verificationId!,
            verificationCode: kPhoneSecondFactorVerificationCode)
          let assertion = PhoneMultiFactorGenerator.assertion(with: credential)
          // Full enrollment. It will replace the underlying tokens
          // and set off ID token change listener.
          person.multiFactor.enroll(with: assertion, displayName: displayName) { (error) in
            // ...
          }
      }
    })

I modified it like this, the crimson warning (Lacking argument for parameter ‘signIn’ in name),

   let person = Auth.auth().currentUser
            person?.multiFactor.getSessionWithCompletion({ (session, error) in
        let configuration = Configuration(requestCode: { cellphone, completion in
            PhoneAuthProvider.supplier().verifyPhoneNumber(cellphone, uiDelegate: nil, multiFactorSession: session) { (verificationId, error) in
                let credential = PhoneAuthProvider.supplier().credential(
                  withVerificationID: verificationId!,
                  verificationCode: kPhoneSecondFactorVerificationCode)
                let assertion = PhoneMultiFactorGenerator.assertion(with: credential)
                // Full enrollment. It will replace the underlying tokens
                // and set off ID token change listener.
                person.multiFactor.enroll(with: assertion, displayName: displayName) { (error) in
                }
            
            }
                                    
        
        })
        
        
        let vc = PhoneVerificationController(configuration: configuration)
        vc.delegate = self
        current(vc, animated: true)
    }

the place do i want to repair

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments