Home > database >  firebase_auth/invalid-phone-number in flutter?
firebase_auth/invalid-phone-number in flutter?

Time:02-17

enter image description here - I'm using phone authentication using firebase in flutter

  • When I enter the number and I'll get the otp,
  • While Entering to the otp field and verify it shows the below error in flutter

I/flutter (27587): [firebase_auth/invalid-phone-number] The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [ ][country code][subscriber number including area code]. [ Invalid format. ]

I was tried sevaral ways but it did't work I was given my verify phone code for firebase given below

>  await auth.verifyPhoneNumber(
>           phoneNumber: phoneNumber,
>           verificationCompleted: verificationCompleted,
>           verificationFailed: verificationFailed,
>           codeSent: codeSent,
>           timeout: const Duration(seconds: 60),
>           codeAutoRetrievalTimeout: codeAutoRetrievalTimeout);

my verify codesin ui section

 await authCalss.verifyPhonenumber(
                                      " 91 ${phonecontroller.text}",
                                      context,
                                      setData);

CodePudding user response:

You should enter the country code, but in this case you have already initialized the country code in your code. so there is no need to enter the country code again. Another way is that you can add your number in firebase as temporary number for testing.

CodePudding user response:

There is no problem with the phone number 919999900000. It seems that the problem is in your configuration.

The configuration should look similar to like this:

enter image description here

Refer to this documentation: https://firebase.flutter.dev/docs/auth/phone

  • Related