[英]blank page after recaptcha verification Authenticate with Firebase on iOS using a Phone Number Swift
After recaptcha verification, page only returned blank. recaptcha验证后,页面只返回空白。 It did nothing to do next step.它没有做下一步。
Screen Shot截屏
在您的应用程序委托的application(_:open:options:)
方法中,调用Auth.auth().canHandle(url)
。
For the blank re-captcha page issue I was able to resolve it by doing these 3 things:对于空白的重新验证码页面问题,我可以通过执行以下 3 件事来解决它:
1st thing-第一件事——
GoogleSerivce-Info.plist
file make sure the REVERSED_CLIENT_ID
is added to your project via the URL types using this .在GoogleSerivce-Info.plist
文件中,确保使用 this将REVERSED_CLIENT_ID
通过 URL 类型添加到您的项目中。 Follow the first part of the second step there: Add custom URL schemes to your Xcode project (look at the screenshot).遵循第二步的第一部分:将自定义 URL 方案添加到您的 Xcode 项目(查看屏幕截图)。2nd thing-第二件事——
In the project navigator select the blue project icon
在项目导航器中选择blue project icon
Select Capabilities
选择Capabilities
Open Background Modes
打开Background Modes
Select Background fetch
选择Background fetch
3rd thing-第三件事——
PhoneAuthProvider.provider(auth: Auth.auth())
在验证电话号码之前调用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.在 iOS 上,appVerificationDisabledForTesting 设置必须在调用 verifyPhoneNumber 之前设置为 TRUE。 This is processed without requiring any APNs token or sending silent push notifications in the background, making it easier to test in a simulator.无需任何 APNs 令牌或在后台发送静默推送通知即可处理此操作,从而更容易在模拟器中进行测试。 This also disables the reCAPTCHA fallback flow.这也会禁用 reCAPTCHA 回退流程。
I face this issue and fix it by adding this code into my AppDelegate.m我面临这个问题并通过将此代码添加到我的 AppDelegate.m 来解决它
- (BOOL) application: (UIApplication *) app
openURL: (NSURL *) url
options: (NSDictionary <UIApplicationOpenURLOptionsKey, id> *)
options {
if ([[FIRAuth auth] canHandleURL: url]) {
return YES;
} else {
// URL not auth related, developer should handle it.
return NO;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.