FirebaseUI-Android icon indicating copy to clipboard operation
FirebaseUI-Android copied to clipboard

6-digit code verification fails if phone number has country code other than +1

Open vijtheveg opened this issue 3 years ago • 2 comments

  • Android device: Nexus 5 (emulator)
  • Android OS version: API 23
  • Google Play Services version: 4.3.8
  • Firebase/Play Services SDK version: com.google.firebase:firebase-auth:21.0.1
  • FirebaseUI version: 8.0.0

Step 3: Describe the problem:

In the Firebase UI on Android, the country code specified with the phone number is not honored when the OTP is being entered. As a result, OTP validation always fails. This was not happening on FirebaseUI version: 7.2.0

Steps to reproduce:

  1. Specify phone numbers +91-8637224557. Note, country code dropdown is shown expanded for some reason (why?) - see attached image "Opens with dropdown expanded"
  2. Press the validate button, solve reCAPTCHA if presented

Observed Results:

See image titled "Note country code" In the page where the 6-digit code needs to be entered, the phone number shown is +1-8637224557 instead of +91-8637224557 - the country code is wrong. As a result, code verification fails

Expected Results:

The correct phone number is shown and code verification succeeds. Also, country code dropdown is not shown expanded when the UI starts.

Relevant Code:

Code is essentially same as that shown in the sample below. Also, my code has not changed in a while (note also that this scenario works as expected in FirebaseUI version: 7.2.0 - this is a regression in version 8.0.0 https://firebase.google.com/docs/auth/android/firebaseui

Note country code Opens with dropdown expanded Country code is wrong here

vijtheveg avatar Aug 09 '21 23:08 vijtheveg

yes even in my case i have to manually type the code in the box

AdityaDarke2 avatar Aug 14 '21 12:08 AdityaDarke2

It seems that whatever the user select in the country code the phone is sent to PhoneNumberVerificationHandler.verifyPhoneNumber is the the initial country code the screen opened with

Shailevy avatar Sep 07 '21 21:09 Shailevy