flutter run -d chrome
I enter the same mobile number but i am receiving otp with this and not on mobile devices. I can't figure out why its happening . Also the otp process completes sucessfully when I'm using test phone numbers offered by firebase.
Following is my code for the otp verification:
void signInWithPhone(BuildContext context, String phoneNumber) async {
try {
await auth.verifyPhoneNumber(
phoneNumber: phoneNumber,
verificationCompleted: (PhoneAuthCredential credential) async {
print('Before-signing in with credential');
await auth.signInWithCredential(credential);
debugPrint('After-signing in with credential');
},
verificationFailed: (e) {
debugPrint(e.message.toString());
debugPrint(" THIS IS ERROR ${e.message}");
showSnackbar(context: context, content: e.message!.trim());
throw Exception(e.message);
},
codeSent: ((String verificationId, int? resendToken) async {
debugPrint('Code sent');
Navigator.pushNamed(context, OTPScreen.routeName,
arguments: verificationId);
}),
codeAutoRetrievalTimeout: (String verificationId) {
debugPrint('Auto retrieval timeout');
});
} on FirebaseAuthException catch (e) {
debugPrint(e.message!);
debugPrint(e.toString());
showSnackbar(context: context, content: e.message!);
}
}
And I'm calling the above function in the following ways :
void sendPhoneNumber() {
try {
debugPrint('VerificationCompleted');
String phoneNumber = phoneController.text.trim();
if (country != null && phoneNumber.isNotEmpty) {
ref
.read(authControllerProvider)
.signInWithPhone('+${country!.phoneCode}$phoneNumber', context);
}
} catch (e) {
showSnackbar(context: context, content: 'Fill the phone number field');
}
}
I get the following errors :
Play Integrity Token fetch failed, falling back to Recaptcha-9: Integrity API error (-9): Binding to the service in the Play Store has failed. This can be due to having an old Play Store version installed on the device.
E/zzb ( 4546): Ask the user to update Play Store.
E/zzb ( 4546): (https://developer.android.com/google/play/integrity/reference/com/google/android/play/core/integrity/model/IntegrityErrorCode.html#CANNOT_BIND_TO_SERVICE).
D/EGL_emulation( 4546): app_time_stats: avg=632.60ms min=33.58ms max=1231.62ms count=2
W/System ( 4546): Ignoring header X-Firebase-Locale because its value was null.
W/LocalRequestInterceptor( 4546): Error getting App Check token; using placeholder token instead. Error: com.google.firebase.FirebaseException: No AppCheckProvider installed.
E/OpenGLRenderer( 4546): Unable to match the desired swap behavior.
E/FirebaseAuth( 4546): [GetAuthDomainTask] Error getting project config. Failed with INVALID_CERT_HASH 400
E/zzb ( 4546): Failed to get reCAPTCHA token with error [There was an error while trying to get your package certificate hash.]- calling backend without app verification
W/WindowOnBackDispatcher( 4546): sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda17@cbdc15b
D/EGL_emulation( 4546): app_time_stats: avg=1098.10ms min=1098.10ms max=1098.10ms count=1
W/System ( 4546): Ignoring header X-Firebase-Locale because its value was null.
W/LocalRequestInterceptor( 4546): Error getting App Check token; using placeholder token instead. Error: com.google.firebase.FirebaseException: No AppCheckProvider installed.
E/FirebaseAuth( 4546): [SmsRetrieverHelper] SMS verification code request failed: unknown status code: 17093 null
D/FirebaseAuth( 4546): Invoking original failure callbacks after phone verification failure for +917387251914, error - This request is missing a valid app identifier, meaning that Play Integrity checks, and reCAPTCHA checks were unsuccessful. Please try again, or check the logcat for more details.
D/CompatibilityChangeReporter( 4546): Compat change id reported: 247079863; UID 10192; state: DISABLED
I/flutter ( 4546): This request is missing a valid app identifier, meaning that Play Integrity checks, and reCAPTCHA checks were unsuccessful. Please try again, or check the logcat for more details.
I/flutter ( 4546): THIS IS ERROR This request is missing a valid app identifier, meaning that Play Integrity checks, and reCAPTCHA checks were unsuccessful. Please try again, or check the logcat for more details.
Steps I performed till now :
I fixed the above error in this way: First of all you need SHA keys .
For that I ran the ./gradlew signingReport
command in the terminal.
It returned the sha keys for my app, These sha keys are the ones you want to include in the firebase console.
NOTE: The SHA keys generated in the above way only worked for me , I had also generated sha keys by using keytool and another method but that didn't worked !