PhoneAuthProvider

class PhoneAuthProvider : NSObject

A concrete implementation of FIRAuthProvider for phone auth providers.

  • Returns an instance of FIRPhoneAuthProvider for the default FIRAuth object.

    Declaration

    Swift

    class func provider() -> Self
  • Returns an instance of FIRPhoneAuthProvider for the provided FIRAuth object.

    Declaration

    Swift

    class func provider(auth: FIRAuth) -> Self

    Parameters

    auth

    The auth object to associate with the phone auth provider instance.

  • Starts the phone number authentication flow by sending a verifcation code to the specified phone number.

    Parameters

    phoneNumber

    The phone number to be verified.

    UIDelegate

    An object used to present the SFSafariViewController. The object is retained by this method until the completion block is executed.

    completion

    The callback to be invoked when the verification flow is finished. Possible error codes:

    • FIRAuthErrorCodeCaptchaCheckFailed - Indicates that the reCAPTCHA token obtained by the Firebase Auth is invalid or has expired.
    • FIRAuthErrorCodeQuotaExceeded - Indicates that the phone verification quota for this project has been exceeded.
    • FIRAuthErrorCodeInvalidPhoneNumber - Indicates that the phone number provided is invalid.
    • FIRAuthErrorCodeMissingPhoneNumber - Indicates that a phone number was not provided.
  • Creates an FIRAuthCredential for the phone number provider identified by the verification ID and verification code.

    Declaration

    Swift

    func credential(withVerificationID verificationID: String, verificationCode: String) -> FIRPhoneAuthCredential

    Parameters

    verificationID

    The verification ID obtained from invoking verifyPhoneNumber:completion:

    verificationCode

    The verification code obtained from the user.

    Return Value

    The corresponding phone auth credential for the verification ID and verification code provided.

  • Please use the provider or providerWithAuth: methods to obtain an instance of FIRPhoneAuthProvider.