Firebase SMS Verification

377 views Asked by At

I was using Firebase Authentication for my flutter application . I configured firebase for and start using this code

      login() async {
        await FirebaseAuth.instance
        .verifyPhoneNumber(
          phoneNumber: '+447123123456',
          verificationCompleted: (PhoneAuthCredential credential) {},
          verificationFailed: (FirebaseAuthException e) {
            print("Code  Failed 2");
            print(e);
          },
          codeSent: (String verificationId, int resendToken) {
            print("Code Send");
          },
          codeAutoRetrievalTimeout: (String verificationId) {},
        )
      );
    }

when i exextute this code it prints

    I/BiChannelGoogleApi(13432): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: 
    com.google.firebase.auth.api.internal.zzaq@3665a442
    I/flutter (13432): Code  Failed 2
    I/flutter (13432): [firebase_auth/null] null

unable to track the error message & the verification code is not send to my device i used this link for reference https://firebase.flutter.dev/docs/auth/phone/

1

There are 1 answers

0
Harshit On

Few of the possible reasons because of which it is not working might be-

  1. You may not have enabled the sms-verification authentication in the firebase console.
  2. Check whether you are connected to internet in emulator or actual device while testing.
  3. Other possible reason can be be the emulator's android image. Try to test in some other modern image which support google play services.