Flutter Firebase Phone auth reCaptcha在iOS上验证后复制了我的登录页面



我有一个登录页面,只有一个字段的电话号码和我使用Firebase电话认证。一切都很好,除了当谷歌reCaptcha出现在web浏览器(不是谷歌chrome和Safari,只是一个web视图),验证后,web浏览器必须回到我的登录页面,但在这个时候,我看到另一个登录页面(initState调用)在我的登录页面。

是否有方法来检测验证码何时完成其工作?

登录功能码:

Future login(String mobile) async
{
setState((){loginInProcess=true;sent=null;});
this.phoneNumber = mobile;
FirebaseAuth _auth = FirebaseAuth.instance;
_auth.setSettings(appVerificationDisabledForTesting:false);
_auth.verifyPhoneNumber(
phoneNumber: this.phoneNumber,
timeout: this.expiredCode,
verificationCompleted: _verificationCompleted,
verificationFailed: verificationFailed,
codeSent: codeSent,
codeAutoRetrievalTimeout: codeAutoRetrievalTimeout
).catchError((error){
setState((){loginInProcess=false;sent=false;});
});
}

我没有找到任何解决方案来收听验证验证码的事件…我建议在登录页面中使用一个测试变量…第二个推送的页面将不会使用这个变量,所以如果它为null,则显示空页面或正在加载页面,直到codeSent或verificationFailed被触发。

相关内容