blank page after recaptcha verification Authenticate with Firebase on iOS using a Phone Number Swift
In your app delegate's application(_:open:options:)
method, call Auth.auth().canHandle(url)
.
For the blank re-captcha page issue I was able to resolve it by doing these 3 things:
1st thing-
- Inside the
GoogleSerivce-Info.plist
file make sure theREVERSED_CLIENT_ID
is added to your project via the URL types using this. Follow the first part of the second step there: Add custom URL schemes to your Xcode project (look at the screenshot).
2nd thing-
In the project navigator select the
blue project icon
Select
Capabilities
Open
Background Modes
Select
Background fetch
3rd thing-
- Before verifying the phone number call
PhoneAuthProvider.provider(auth: Auth.auth())
@IBAction func phoneButton(sender: UIButton) {
// ***step 5***
PhoneAuthProvider.provider(auth: Auth.auth())
PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumberTextField.text!, uiDelegate: nil) {
(verificationID, error) in
if let error = error {
print(error.localizedDescription)
return
}
guard let verificationId = verificationID else { return }
// do something with verificationID
}
}
On iOS, the appVerificationDisabledForTesting setting has to be set to TRUE before calling verifyPhoneNumber. This is processed without requiring any APNs token or sending silent push notifications in the background, making it easier to test in a simulator. This also disables the reCAPTCHA fallback flow.
Firebase Docs