FIRPhoneAuthProvider


@interface FIRPhoneAuthProvider : 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

    Objective-C

    + (nonnull instancetype)provider;
  • Returns an instance of FIRPhoneAuthProvider for the provided FIRAuth object.

    Declaration

    Swift

    class func provider(auth: FIRAuth) -> Self

    Objective-C

    + (nonnull instancetype)providerWithAuth:(nonnull FIRAuth *)auth;

    Parameters

    auth

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

  • Please use verifyPhoneNumber:UIDelegate:completion: instead.

    Possible error codes:

    + `FIRAuthErrorCodeAppNotVerified` - Indicates that Firebase could not retrieve the
        silent push notification and therefore could not verify your app.
    + `FIRAuthErrorCodeInvalidAppCredential` - Indicates that The APNs device token provided
        is either incorrect or does not match the private certificate uploaded to the Firebase
        Console.
    + `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.
    + `FIRAuthErrorCodeMissingAppToken` - Indicates that the APNs device token could not be
        obtained. The app may not have set up remote notification correctly, or may fail to
        forward the APNs device token to FIRAuth if app delegate swizzling is disabled.
    

    Declaration

    Swift

    func verifyPhoneNumber(_ phoneNumber: String, completion: VerificationResultCallback? = nil)

    Objective-C

    - (void)verifyPhoneNumber:(nonnull NSString *)phoneNumber
                   completion:(nullable FIRVerificationResultCallback)completion;

    Parameters

    phoneNumber

    The phone number to be verified.

    completion

    The callback to be invoked when the verification flow is finished.

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

    Declaration

    Objective-C

    - (void)verifyPhoneNumber:(nonnull NSString *)phoneNumber
                   UIDelegate:(nullable id<FIRAuthUIDelegate>)UIDelegate
                   completion:(nullable FIRVerificationResultCallback)completion;

    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

    Objective-C

    - (nonnull FIRPhoneAuthCredential *)
    credentialWithVerificationID:(nonnull NSString *)verificationID
                verificationCode:(nonnull NSString *)verificationCode;

    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.

    Declaration

    Objective-C

    - (nonnull instancetype)init;