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.71k stars 3.97k forks source link

[firebase_auth] sms not being sent on some devices #2766

Closed athlona64 closed 4 years ago

athlona64 commented 4 years ago

Describe the bug a phone number authentication not send sms to desination. this behavior is happen in some phone number on some device. i'm not sure why firebase is block phone number on device i try change device but use same phone number is sent and i use different phone number with old phone is sent same.

To Reproduce Steps to reproduce the behavior:

  1. fill phone number
  2. request sms from firebase
  3. verify is complete but codeSent is not call and can't signin

Expected behavior

            await FirebaseAuth.instance.verifyPhoneNumber(
                phoneNumber: phoneNumber,
                timeout: const Duration(seconds: 10),
                verificationCompleted: verificationCompleted,
                verificationFailed: verificationFailed,
                codeSent: codeSent,
                codeAutoRetrievalTimeout: codeAutoRetrievalTimeout);

codeSent is not call in some phone number on some device

Additional context

            await FirebaseAuth.instance.verifyPhoneNumber(
                phoneNumber: phoneNumber,
                timeout: const Duration(seconds: 10),
                verificationCompleted: verificationCompleted,
                verificationFailed: verificationFailed,
                codeSent: codeSent,
                codeAutoRetrievalTimeout: codeAutoRetrievalTimeout);

Flutter doctor Run flutter doctor and paste the output below:

[√] Flutter (Channel stable, v1.17.0, on Microsoft Windows [Version 10.0.18362.900], locale en-US)
    • Flutter version 1.17.0 at C:\src\flutter
    • Framework revision e6b34c2b5c (6 weeks ago), 2020-05-02 11:39:18 -0700
    • Engine revision 540786dd51
    • Dart version 2.8.1

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:\Users\prapa\AppData\Local\Android\Sdk
    • Platform android-29, build-tools 29.0.3
    • ANDROID_HOME = C:\Users\prapa\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    • All Android licenses accepted.

[√] Android Studio (version 3.6)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] Connected device (1 available)
    • sdk gphone x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

• No issues found!

Pubspec.yaml


environment:
  sdk: ">=2.3.0 <3.0.0"

dependencies:
  flutter_platform_widgets: ^0.20.3-beta.1
  path_provider: ^1.3.0
  flutter:
    sdk: flutter
  permission: ^0.1.3
  share: ^0.6.3+6
  fluttertoast: ^3.1.3
  shared_preferences: 0.4.3
  flutter_screenutil: ^0.5.2
  qr_flutter: ^3.0.1
  web3dart: ^1.1.1+1
  web_socket_channel: ^1.0.8
  bip39: ^1.0.2
  bitcoin_flutter: ^2.0.0
  toast: ^0.1.3
  crypto: ^2.1.4
  flutter_spinkit: ^4.1.1+1
  after_layout: ^1.0.7+2
  cached_network_image: ^2.0.0
  intl: ^0.16.0
#  firebase_ml_vision: ^0.9.3+8
  barcode_scan: ^3.0.1
  ethereum: 4.0.1
  bmnav: 0.3.4
  loading_indicator: ^1.0.0
  image_gallery_saver: ^1.2.2
  firebase_storage: ^3.1.1
  package_info: ^0.4.0+13
  native_widgets: ^1.3.5

    # The following adds the Cupertino Icons font to your application.
    # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  modal_progress_hud: ^0.1.2
  http: ^0.12.0+2
  auto_size_text: ^2.0.1
  flutter_file_manager: ^0.2.0
  contacts_service: ^0.0.8
  pattern_formatter: ^1.0.1
  countdown: ^0.1.0
  english_words: ^3.1.0
  #man
  ed25519_hd_key: ^1.0.1
  dart_ssss: ^0.0.5
  local_auth: ^0.6.0+1
  get_it: ^3.0.1
  passcode_screen:
    path: ./passcode_screen-1.0.2

#  firebase_auth: 0.15.3+1
  sms_receiver: ^0.3.1+1
  sms_autofill: ^1.2.1
  firebase_auth: ^0.16.1
  firebase_core: 0.4.4
  permission_handler: ^4.4.0+hotfix.2
  firebase_analytics: ^5.0.6
  pull_to_refresh: ^1.5.7
  cloud_firestore: ^0.12.11
  bip32_dart: ^1.0.5
  json_annotation: ^3.0.0
  provider: ^3.2.0
  flutter_share_me: ^0.9.0
  encrypt: ^4.0.0
  flutter_secure_storage: ^3.3.1+1
  ads: ^1.7.2
  image_picker: ^0.6.3+1
  http_parser: ^3.1.3
  dio: ^3.0.8
  infinite_listview: ^1.0.1+1
  qrscan: ^0.2.17
  rxdart: ^0.23.1
  keyboard_actions: ^3.2.0
  keyboard_visibility: ^0.5.6
  carousel_slider: ^1.3.0
  mqtt_client: ^6.1.0
  in_app_update: ^1.1.7
  store_redirect: ^1.0.2
  url_launcher: ^5.4.7
  dash_chat:
    path: ./dash_chat
  avataaar_image: ^1.0.8
  esys_flutter_share: ^1.0.2
  #ios pod
#  flutter_camera_ml_vision: ^2.2.4
  camera: ^0.5.7+3s

  #ios pod
#  flutter_camera_ml_vision: ^2.2.4
#  qr_mobile_vision: ^1.0.1+1
  flutter_camera_ml_vision: ^2.2.5
  launch_review: ^2.0.0
  firebase_messaging: ^6.0.9
  flutter_local_notifications: ^1.2.0+2
  flare_flutter: ^1.8.3
  date_format: any
  webview_flutter: ^0.3.21
  firebase_ml_vision: ^0.9.3+8
  firebase_crashlytics: ^0.1.3+3
  adobe_xd:
  flutter_svg:
  device_apps: ^1.0.9

  #Opt-in to the embedded views preview by adding a boolean property to the app's Info.plist file with the key io.flutter.embedded_views_preview and the value YES.

#  flutter_money_formatter:
#    path: ./flutter_money_formatter
  snaplist: ^0.1.8
TheDevelolper commented 4 years ago

+1 This sent an OTP to my device then stopped working for that Android phone. However it still allows me to send an OTP to another iPhone multiple times.

TahaTesser commented 4 years ago

Hi @athlona64 firebase_auth: ^0.16.1 using official example, sms code is sent on Samsung device

flutter doctor -v ``` [✓] Flutter (Channel dev, 1.20.0-0.0.pre, on Mac OS X 10.15.5 19F101, locale en-GB) • Flutter version 1.20.0-0.0.pre at /Users/tahatesser/Code/flutter_dev • Framework revision d9653445f4 (6 days ago), 2020-06-09 18:43:03 -0400 • Engine revision e8c13aa012 • Dart version 2.9.0 (build 2.9.0-14.0.dev 5c1376615e) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0) • Android SDK at /Users/tahatesser/Code/sdk • Platform android-30, build-tools 30.0.0 • ANDROID_HOME = /Users/tahatesser/Code/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 11.5) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.5, Build version 11E608c • CocoaPods version 1.9.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.0) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 46.0.2 • Dart plugin version 193.7361 • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) [✓] VS Code (version 1.46.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.11.0 [✓] Connected device (4 available) • SM M305F • 32003c30dc19668f • android-arm64 • Android 10 (API 29) • macOS • macOS • darwin-x64 • Mac OS X 10.15.5 19F101 • Web Server • web-server • web-javascript • Flutter Tools • Chrome • chrome • web-javascript • Google Chrome 83.0.4103.97 • No issues found! ```
TheDevelolper commented 4 years ago

@TahaTesser...

I'm using: firebase_auth: ^0.16.1 firebase_core: ^0.4.5

and I am observing the same issues.

TheDevelolper commented 4 years ago

@TahaTesser this ticket shouldn't be marked as blocked... you've not given anyone an opportunity to respond to you!

TahaTesser commented 4 years ago

@ISimplifyComplexity it's waiting for response label

TheDevelolper commented 4 years ago

@TahaTesser I've just responded to you confirming that I'm using the version you suggested and that it's not working. Therefore I do not think that this is blocked awaiting a response anymore.

TahaTesser commented 4 years ago

Could be duplicate https://github.com/FirebaseExtended/flutterfire/issues/2769 working in my case, no issues

TheDevelolper commented 4 years ago

@TahaTesser I almost get the feeling that it's caching the login credentials but I don't seem to be able to uncache them. Even when dealing cache and app settings and uninstalling the app.

There are a number of tickets that keeping arising on this and similar issues but many of them just get closed off.

For now I'm going to just write my own Auth server. Send my own SMS using Twilio because this is just too flakey.

stackchain commented 4 years ago

Same problem here, everything works perfectly on both platforms except for OTP -> code working just fine on Android (simulator + real phone), however just crashes on IOS (simulator + real phone) - not even able to catch that exception.

0   CoreFoundation                      0x00007fff23e3cf0e __exceptionPreprocess + 350
1   libobjc.A.dylib                     0x00007fff50ba89b2 objc_exception_throw + 48
2   CoreFoundation                      0x00007fff23e3cd4c +[NSException raise:format:] + 188
3   Runner                              0x0000000107eb6a41 -[FIRPhoneAuthProvider verifyPhoneNumber:UIDelegate:completion:] + 193
4   Runner                              0x0000000107fbbc60 -[FLTFirebaseAuthPlugin handleMethodCall:result:] + 17488
5   Flutter                             0x0000000108b019df __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 104
6   Flutter                             0x0000000108a90622 _ZNK7flutter21PlatformMessageRouter21HandlePlat<…>

❯ flutter doctor -v [✓] Flutter (Channel unknown, v1.17.3, on Mac OS X 10.15.5 19F101, locale en-CA) • Flutter version 1.17.3 at /Users/stacky/.asdf/installs/flutter/1.17.3 • Framework revision b041144f83 (13 days ago), 2020-06-04 09:26:11 -0700 • Engine revision ee76268252 • Dart version 2.8.4 [✓] Xcode - develop for iOS and macOS (Xcode 11.5) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.5, Build version 11E608c • CocoaPods version 1.9.1

TheDevelolper commented 4 years ago

I can send an OTP from Android to IOS and it worked buy I can't send it to the same android. It just goes to verified and the current user is null.

On Wed, 17 Jun 2020, 14:45 Juliano Lazzarotto, notifications@github.com wrote:

Same problem here, everything works perfectly on both platforms except for OTP -> code working just fine on Android (simulator + real phone), however just crashes on IOS (simulator + real phone) - not even able to catch that exception.

( 0 CoreFoundation 0x00007fff23e3cf0e exceptionPreprocess + 350 1 libobjc.A.dylib 0x00007fff50ba89b2 objc_exception_throw + 48 2 CoreFoundation 0x00007fff23e3cd4c +[NSException raise:format:] + 188 3 Runner 0x0000000107eb6a41 -[FIRPhoneAuthProvider verifyPhoneNumber:UIDelegate:completion:] + 193 4 Runner 0x0000000107fbbc60 -[FLTFirebaseAuthPlugin handleMethodCall:result:] + 17488 5 Flutter 0x0000000108b019df 45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 104 6 Flutter 0x0000000108a90622 _ZNK7flutter21PlatformMessageRouter21HandlePlat<…>

❯ flutter doctor -v [✓] Flutter (Channel unknown, v1.17.3, on Mac OS X 10.15.5 19F101, locale en-CA) • Flutter version 1.17.3 at /Users/stacky/.asdf/installs/flutter/1.17.3 • Framework revision b041144f83 (13 days ago), 2020-06-04 09:26:11 -0700 • Engine revision ee76268252 • Dart version 2.8.4 [✓] Xcode - develop for iOS and macOS (Xcode 11.5) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.5, Build version 11E608c • CocoaPods version 1.9.1

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/FirebaseExtended/flutterfire/issues/2766#issuecomment-645383046, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6XBOLWQW5GDDIDCPIC2WTRXDCHPANCNFSM4N7MKLUQ .

athlona64 commented 4 years ago

issue is not resolve i don't know why in flutter not work but website still working

Ehesp commented 4 years ago

Hi all - please upgrade to the latest version, this has been reworked & tested. See https://firebase.flutter.dev/docs/auth/phone for more information.