0
votes

I have a login page with juste one field for phone number and im using Firebase Phone Auth. Everything is okay except when google reCaptcha appeared in the web browser (not google chrome and not Safari, just a web view), after verification, the web browser have to back to my login page but at this time, i see another login page (initState called) above my login page.

Is there anyway to detect at least when reCaptcha finished its job ?

Login function code:

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;});
    });
}
1

1 Answers

0
votes

i did not find any solution to listen to the event of validating reCaptcha... i propose to use a testing variable in the login page... the second pushed page will not use this variable, so if it is null, show empty page or loading page until codeSent or verificationFailed is being fired.