firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.7k stars 3.97k forks source link

[firebase_auth]: internal-error when trying to verifyPhoneNumber #13285

Closed dhurem closed 1 month ago

dhurem commented 1 month ago

Is there an existing issue for this?

Which plugins are affected?

Auth

Which platforms are affected?

Android, iOS

Description

Using the verifyPhoneNumber to send an SMS code to a dedicated phone number fails with the following error: "An internal error has occurred, print and inspect the error details for more information."

This happened using versions 4.6.3 as well as version 5.2.0.

Reproducing the issue

  1. Create a flutter project and add firebase_auth, firebase_core packages (5.2.0 and 3.4.0 respectively)
  2. Try to trigger await firebase.FirebaseAuth.instance.verifyPhoneNumber with a valid phone number format

Expected behavior: verificationCompleted gets triggered after a successful verification as expected

Actual behavior: receiving 500 internal error with the message: [firebase_auth/internal-error] An internal error has occurred, print and inspect the error details for more information.

Firebase Core version

2.14.0 and 3.4.0

Flutter Version

3.16.9

Relevant Log Output

code = "internal-error"
message = "An internal error has occurred, print and inspect the error details for more information."

Flutter dependencies

Expand Flutter dependencies snippet
```yaml Replace this line with the contents of your `flutter pub deps -- --style=compact`. ```

Additional context and comments

No response

SnirYaZem commented 1 month ago

I'm having the same issue even with firebase_core 3.0.0 and firebase_auth 5.0.0

SelaseKay commented 1 month ago

Hi, thanks for the report. Are you using a test number?

dhurem commented 1 month ago

No, I was testing with valid phone numbers from multiple countries.

Note: I made sure I have not set up any region restrictions on firebase itself.

hajini commented 1 month ago

I'm trying to find out the causes but there are no other error message. Last month when i use 4.9 version, there was no problem. but, why it makes error. I'm not sure even when this error started. I had version up but it still in there. firebase_auth: ^5.2.0, firebase_core: ^3.4.0

mohamedsaad221 commented 1 month ago

I'm having the same issue

firebase_auth: ^4.7.1 firebase_core: ^2.15.0

Flutter Version : 3.16.4

mohamedsaad221 commented 1 month ago

any update here ?

jaysharma-glitch commented 1 month ago

Facing the same issue with these versions: firebase_core: ^2.22.0 firebase_auth: ^4.7.5

Flutter Version - 3.22.1

russellwheatley commented 1 month ago

I have tested on Firebase Auth iOS but i received "invalid-app-credential" which I think is because of update to firebase-ios-sdk. Apparently it has been fixed in latest version (11.2.0) so I will raise a PR for bumping iOS version: https://github.com/firebase/firebase-ios-sdk/issues/13479

I logged in with android phone auth successfully.

urvashi-k-7span commented 1 month ago

Any update? Same issue here.

Zeehshan commented 1 month ago

I am also getting same issue Can someone resolved it ?

ming-chu commented 1 month ago

@russellwheatley Looks like we got the same error.

I got an error different from the original post when calling verifyPhoneNumber() on a real iOS device with a real phone number. It received an [firebase_auth/invalid-app-credential] error from verificationFailed callback:

error:

flutter: [firebase_auth/invalid-app-credential] Token mismatch

plugins version:

firebase_core: ^3.3.0
firebase_auth: ^5.0.0
flutter --version
Flutter 3.24.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 80c2e84975 (8 weeks ago) • 2024-07-30 23:06:49 +0700
Engine • revision b8800d88be
Tools • Dart 3.5.0 • DevTools 2.37.2

iOS Version: 17.6.1 XCode Version: 16.0 (16A242d)

Peng-Qian commented 1 month ago

@russellwheatley Looks like we got the same error.

I got an error different from the original post when calling verifyPhoneNumber() on a real iOS device with a real phone number. It received an [firebase_auth/invalid-app-credential] error from verificationFailed callback:

error:

flutter: [firebase_auth/invalid-app-credential] Token mismatch

plugins version:

firebase_core: ^3.3.0
firebase_auth: ^5.0.0
flutter --version
Flutter 3.24.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 80c2e84975 (8 weeks ago) • 2024-07-30 23:06:49 +0700
Engine • revision b8800d88be
Tools • Dart 3.5.0 • DevTools 2.37.2

iOS Version: 17.6.1 XCode Version: 16.0 (16A242d)

Same issue here.

I suspect the problem lies in the communication between FMC and Apple’s remote background notification system within the package.

In my case, the iOS emulator works fine, and disabling push notifications allows me to trigger reCAPTCHA and send SMS verification codes on a real device.

Workaround:

  firebase_auth: 5.1.4
  firebase_core: 3.3.0
Zeehshan commented 1 month ago

Still not fixed