FIRPhoneAuthProvider
@interface FIRPhoneAuthProvider : NSObjectA concrete implementation of AuthProvider for phone auth providers.
This class is available on iOS only.
-
Returns an instance of
PhoneAuthProviderfor the defaultAuthobject.Declaration
Objective-C
+ (nonnull instancetype)provider; -
Returns an instance of
PhoneAuthProviderfor the providedAuthobject.Declaration
Objective-C
+ (nonnull instancetype)providerWithAuth:(nonnull FIRAuth *)auth;Parameters
authThe auth object to associate with the phone auth provider instance.
-
Starts the phone number authentication flow by sending a verification code to the specified phone number.
Declaration
Objective-C
- (void)verifyPhoneNumber:(nonnull NSString *)phoneNumber UIDelegate:(nullable id<FIRAuthUIDelegate>)UIDelegate completion:(nullable void (^)(NSString *_Nullable, NSError *_Nullable))completion;Parameters
phoneNumberThe phone number to be verified.
UIDelegateAn object used to present the SFSafariViewController. The object is retained by this method until the completion block is executed.
completionThe callback to be invoked when the verification flow is finished. Possible error codes:
AuthErrorCodeCaptchaCheckFailed- Indicates that the reCAPTCHA token obtained by the Firebase Auth is invalid or has expired.AuthErrorCodeQuotaExceeded- Indicates that the phone verification quota for this project has been exceeded.AuthErrorCodeInvalidPhoneNumber- Indicates that the phone number provided is invalid.AuthErrorCodeMissingPhoneNumber- Indicates that a phone number was not provided.
-
Verify ownership of the second factor phone number by the current user.
Declaration
Objective-C
- (void)verifyPhoneNumber:(nonnull NSString *)phoneNumber UIDelegate:(nullable id<FIRAuthUIDelegate>)UIDelegate multiFactorSession:(nullable FIRMultiFactorSession *)session completion:(nullable void (^)(NSString *_Nullable, NSError *_Nullable))completion;Parameters
phoneNumberThe phone number to be verified.
UIDelegateAn object used to present the SFSafariViewController. The object is retained by this method until the completion block is executed.
sessionA session to identify the MFA flow. For enrollment, this identifies the user trying to enroll. For sign-in, this identifies that the user already passed the first factor challenge.
completionThe callback to be invoked when the verification flow is finished.
-
Verify ownership of the second factor phone number by the current user.
Declaration
Objective-C
- (void)verifyPhoneNumberWithMultiFactorInfo: (nonnull FIRPhoneMultiFactorInfo *)phoneMultiFactorInfo UIDelegate: (nullable id<FIRAuthUIDelegate>)UIDelegate multiFactorSession: (nullable FIRMultiFactorSession *)session completion:(nullable void (^)( NSString *_Nullable, NSError *_Nullable))completion;Parameters
phoneMultiFactorInfoThe phone multi factor whose number need to be verified.
UIDelegateAn object used to present the SFSafariViewController. The object is retained by this method until the completion block is executed.
sessionA session to identify the MFA flow. For enrollment, this identifies the user trying to enroll. For sign-in, this identifies that the user already passed the first factor challenge.
completionThe callback to be invoked when the verification flow is finished.
-
Creates an
AuthCredentialfor the phone number provider identified by the verification ID and verification code.Declaration
Objective-C
- (nonnull FIRPhoneAuthCredential *) credentialWithVerificationID:(nonnull NSString *)verificationID verificationCode:(nonnull NSString *)verificationCode;Parameters
verificationIDThe verification ID obtained from invoking verifyPhoneNumber:completion:
verificationCodeThe 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()orprovider(auth:)methods to obtain an instance ofPhoneAuthProvider.Declaration
Objective-C
- (nonnull instancetype)init;