'Firebase Flutter phone authentication verificationCompleted never get called
i'm would like to add a button for existing user to verify phone number on their profile page,
Future<void> phoneVerification(String _mobile) async {
await _auth.verifyPhoneNumber(
phoneNumber: _mobile,
verificationCompleted: (PhoneAuthCredential phoneAuthCredential) async {
await userInfo.linkWithCredential(phoneAuthCredential);
},
verificationFailed: (FirebaseAuthException e) async {
// Handle error
print(e);
},
codeSent: (String verificationId, int resendToken) async {
},
codeAutoRetrievalTimeout: (String verificationId) async {
},
);
}
however nothing happened even i entered the OTP, verificationCompleted is not called
FlatButton(
onPressed: () async {
setState(() {
PhoneAuthCredential phoneAuthCredential = PhoneAuthProvider.credential(verificationId: verificationId, smsCode: OTP);
});
},
child: Text("VERIFY"),
color: Colors.blue,
textColor: Colors.white,
),
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
