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

🐛 [remote_config] AB testing: Instance ID token is invalid #4016

Closed tgpsantos closed 3 years ago

tgpsantos commented 4 years ago

Bug report

Describe the bug I'm doing a simple AB test using remote_config and I wanted to add my device as a "test device" so that I could test the AB testing, but I'm getting an error saying that my device ID is invalid. I couldn't find a good way to get the firebase instance id.

Steps to reproduce

Steps to reproduce the behavior:

  1. Create an AB test. Then open "Manage Test Devices" in the AB test screen that you just created. You should get a dialog like this imagem

  2. Next step is to get the Firebase Instance ID. FlutterFire APIs don't give direct access to FirebaseApp instance id, so it is recommended that one uses Firebase Messaging package to get its Token, which should also be accepted for this purpose (See link)

  3. After printing FirebaseMessaging().getToken(), copy that to your clipboard. When you call get token, you get something in the following format: NNNNNNN:MMMMMMMMMMMMMMMMMM.

  4. Paste it in the dialog shown in 1 (PS: tried both full token and only NNNNNNN part). imagem

Expected behavior

Device should be added to test devices.

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` [√] Flutter (Channel stable, 1.22.2, on Microsoft Windows [Version 10.0.18363.1139], locale en-GB) [√] Android toolchain - develop for Android devices (Android SDK version 29.0.2) [!] Android Studio (version 4.1.0) X Flutter plugin not installed; this adds Flutter specific functionality. X Dart plugin not installed; this adds Dart specific functionality. [√] VS Code (version 1.50.1) [√] Connected device (1 available) ```

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand ``` Dart SDK 2.10.2 Flutter SDK 1.22.2 dependencies: - camera 0.5.8+99 [flutter provider flutter_localizations flutter_svg firebase_auth cloud_firestore firebase_core flutter_spinkit google_sign_in flutter_facebook_login devic e_preview chewie video_player connectivity volume_control auto_size_text sensors webview_flutter preload_page_view clipboard firebase_dynamic_links flutter_tts audioplayers firebase_analytics firebase_crashlytics path_provider firebase_storage flutter_ffmpeg wakelock percent_indicator animated_overflow fl_chart disk_space shared_preferences int l flutter_rating_bar firebase_remote_config firebase_messaging] - e2e 0.2.4+4 [flutter flutter_test] - flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine] - flutter_launcher_icons 0.7.5 [image args yaml] dev dependencies: - flutter_driver 0.0.0 [file json_rpc_2 meta path web_socket_channel vm_service_client webdriver flutter flutter_test fuchsia_remote_debug_protocol archive args async boolea n_selector characters charcode clock collection convert crypto fake_async matcher platform process pub_semver source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api typed_data vector_math] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_ch annel string_scanner term_glyph typed_data] - pedantic 1.9.0 transitive dependencies: - animated_overflow 1.0.1 [flutter simple_animations] - archive 2.0.13 [crypto args path] - args 1.6.0 - async 2.5.0-nullsafety.1 [collection] - audioplayers 0.16.1 [uuid path_provider flutter flutter_web_plugins] - auto_size_text 2.1.0 [flutter] - boolean_selector 2.1.0-nullsafety.1 [source_span string_scanner] - characters 1.1.0-nullsafety.3 - charcode 1.2.0-nullsafety.1 - chewie 0.9.10 [open_iconic_flutter video_player wakelock flutter] - clipboard 0.1.2+8 [flutter] - clock 1.1.0-nullsafety.1 - cloud_firestore 0.14.0+2 [flutter meta quiver firebase_core firebase_core_platform_interface cloud_firestore_platform_interface cloud_firestore_web] - cloud_firestore_platform_interface 2.0.1 [flutter meta collection firebase_core plugin_platform_interface] - cloud_firestore_web 0.2.0+1 [flutter flutter_web_plugins firebase http_parser meta firebase_core cloud_firestore_platform_interface js] - collection 1.15.0-nullsafety.3 - connectivity 0.4.9+2 [flutter meta connectivity_platform_interface connectivity_macos connectivity_for_web] - connectivity_for_web 0.3.1+2 [connectivity_platform_interface flutter_web_plugins flutter] - connectivity_macos 0.1.0+4 [flutter] - connectivity_platform_interface 1.0.6 [flutter meta plugin_platform_interface] - convert 2.1.1 [charcode typed_data] - crypto 2.1.5 [collection convert typed_data] - device_preview 0.4.8 [font_awesome_flutter http freezed_annotation json_annotation flutter flutter_localizations meta shared_preferences shared_preferences_macos] - disk_space 0.0.3 [flutter] - equatable 1.2.5 [collection meta] - fake_async 1.2.0-nullsafety.1 [clock collection] - ffi 0.1.3 - file 6.0.0-nullsafety.2 [meta path] - firebase 7.3.0 [http http_parser js] - firebase_analytics 6.0.0 [meta flutter firebase_core firebase_analytics_web firebase_analytics_platform_interface] - firebase_analytics_platform_interface 1.0.3 [flutter meta] - firebase_analytics_web 0.1.1 [flutter flutter_web_plugins firebase firebase_analytics_platform_interface meta] - firebase_auth 0.18.0+1 [meta firebase_core firebase_core_platform_interface firebase_auth_platform_interface firebase_auth_web flutter] - firebase_auth_platform_interface 2.0.1 [flutter meta firebase_core plugin_platform_interface] - firebase_auth_web 0.3.0+1 [flutter flutter_web_plugins firebase meta http_parser intl firebase_core firebase_auth_platform_interface js] - firebase_core 0.5.1 [firebase_core_platform_interface flutter quiver meta firebase_core_web] - firebase_core_platform_interface 2.0.0 [flutter meta plugin_platform_interface quiver] - firebase_core_web 0.2.0 [firebase firebase_core_platform_interface flutter flutter_web_plugins meta js] - firebase_crashlytics 0.2.1+1 [flutter stack_trace firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface] - firebase_crashlytics_platform_interface 1.1.1 [flutter meta collection firebase_core plugin_platform_interface] - firebase_dynamic_links 0.6.0 [flutter firebase_core] - firebase_messaging 7.0.3 [meta flutter firebase_core] - firebase_remote_config 0.4.1 [flutter firebase_core] - firebase_storage 4.0.0 [flutter firebase_core] - fl_chart 0.12.0 [flutter path_drawing equatable] - flutter_facebook_login 3.0.0 [flutter collection] - flutter_ffmpeg 0.3.0 [flutter] - flutter_localizations 0.0.0 [flutter intl characters collection meta path typed_data vector_math] - flutter_rating_bar 3.0.1+1 [flutter] - flutter_spinkit 4.1.2+1 [flutter] - flutter_svg 0.18.1 [path_drawing xml vector_math meta flutter] - flutter_tts 1.2.7 [flutter flutter_web_plugins] - flutter_web_plugins 0.0.0 [flutter characters collection meta typed_data vector_math] - font_awesome_flutter 8.8.1 [flutter] - freezed_annotation 0.11.0+1 [collection json_annotation meta] - fuchsia_remote_debug_protocol 0.0.0 [json_rpc_2 process web_socket_channel flutter_test flutter_driver archive args async boolean_selector charcode clock collection conver t crypto fake_async file matcher meta path platform pub_semver source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api typed_data vector_math vm_ service_client webdriver] - google_sign_in 4.5.4 [google_sign_in_platform_interface flutter meta google_sign_in_web] - google_sign_in_platform_interface 1.1.2 [flutter meta quiver] - google_sign_in_web 0.9.1+1 [google_sign_in_platform_interface flutter flutter_web_plugins meta js] - http 0.12.2 [http_parser path pedantic] - http_parser 3.1.4 [charcode collection source_span string_scanner typed_data] - image 2.1.14 [archive xml] - intl 0.16.1 [path] - js 0.6.2 - json_annotation 3.0.1 - json_rpc_2 2.2.2 [stack_trace stream_channel] - matcher 0.12.10-nullsafety.1 [stack_trace] - meta 1.3.0-nullsafety.3 - nested 0.0.4 [flutter] - open_iconic_flutter 0.3.0 [flutter] - path 1.8.0-nullsafety.1 - path_drawing 0.4.1+1 [vector_math meta path_parsing flutter] - path_parsing 0.1.4 [vector_math meta] - path_provider 1.6.14 [flutter path_provider_platform_interface path_provider_macos path_provider_linux] - path_provider_linux 0.0.1+2 [path xdg_directories path_provider_platform_interface flutter] - path_provider_macos 0.0.4+3 [flutter] - path_provider_platform_interface 1.0.3 [flutter meta platform plugin_platform_interface] - path_provider_windows 0.0.4+1 [path_provider_platform_interface meta path flutter ffi win32] - percent_indicator 2.1.7+4 [flutter] - petitparser 3.0.4 [meta] - platform 3.0.0-nullsafety.2 - plugin_platform_interface 1.0.2 [meta] - preload_page_view 0.1.4 [flutter] - process 4.0.0-nullsafety.2 [file path platform] - provider 4.3.2+2 [flutter nested collection] - pub_semver 1.4.4 [collection] - quiver 2.1.3 [matcher meta] - sa_anicoto 1.0.3 [flutter supercharged] - sa_multi_tween 1.1.2 [flutter supercharged] - sa_stateless_animation 1.0.3 [flutter supercharged sa_anicoto] - sa_v1_migration 1.1.2 [flutter] - sensors 0.4.2+4 [flutter] - shared_preferences 0.5.12 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web shared_preferences_w indows] - shared_preferences_linux 0.0.2+2 [file flutter meta path path_provider_linux shared_preferences_platform_interface] - shared_preferences_macos 0.0.1+10 [shared_preferences_platform_interface flutter] - shared_preferences_platform_interface 1.0.4 [meta flutter] - shared_preferences_web 0.1.2+7 [shared_preferences_platform_interface flutter flutter_web_plugins meta] - shared_preferences_windows 0.0.1+1 [shared_preferences_platform_interface flutter ffi file meta path path_provider_platform_interface path_provider_windows] - simple_animations 2.2.2 [flutter sa_multi_tween sa_anicoto sa_stateless_animation sa_v1_migration] - sky_engine 0.0.99 - source_span 1.8.0-nullsafety.2 [charcode collection path term_glyph] - stack_trace 1.10.0-nullsafety.1 [path] - stream_channel 2.1.0-nullsafety.1 [async] - string_scanner 1.1.0-nullsafety.1 [charcode source_span] - supercharged 1.10.0 [supercharged_dart flutter] - supercharged_dart 1.2.0 - sync_http 0.2.0 - term_glyph 1.2.0-nullsafety.1 - test_api 0.2.19-nullsafety.2 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher] - typed_data 1.3.0-nullsafety.3 [collection] - uuid 2.2.2 [crypto convert] - vector_math 2.1.0-nullsafety.3 - video_player 0.10.12+2 [meta video_player_platform_interface video_player_web flutter] - video_player_platform_interface 2.1.1 [flutter meta] - video_player_web 0.1.3+2 [flutter flutter_web_plugins meta video_player_platform_interface] - vm_service_client 0.2.6+2 [async collection json_rpc_2 pub_semver source_span stack_trace stream_channel web_socket_channel] - volume_control 0.1.3 [flutter] - wakelock 0.1.4+2 [flutter] - web_socket_channel 1.1.0 [async crypto stream_channel] - webdriver 2.1.2 [archive matcher path stack_trace sync_http] - webview_flutter 0.3.22+1 [flutter] - win32 1.7.3 [ffi] - xdg_directories 0.1.2 [meta path process] - xml 4.2.0 [collection convert meta petitparser] - yaml 2.2.1 [charcode collection string_scanner source_span] ```

markusaksli-nc commented 4 years ago

Hi @tgpsantos This works just fine for me when pasting in the whole FCM Token on the latest flutter master.

flutter doctor -v ``` [√] Flutter (Channel master, 1.24.0-7.0.pre.72, on Microsoft Windows [Version 10.0.19041.572], locale en-US) • Flutter version 1.24.0-7.0.pre.72 at C:\Development\flutter_master • Framework revision a2a4e9eda4 (10 hours ago), 2020-11-02 20:12:47 -0800 • Engine revision 3460519398 • Dart version 2.12.0 (build 2.12.0-3.0.dev) [√] Android toolchain - develop for Android devices (Android SDK version 30.0.2) • Android SDK at C:\Users\marku\AppData\Local\Android\sdk • Platform android-30, build-tools 30.0.2 • Java binary at: C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\201.6858069\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.6.5) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.6.30320.27 • Windows 10 SDK version 10.0.18362.0 [√] Android Studio (version 4.1.0) • Android Studio at C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\201.6858069 • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) [√] IntelliJ IDEA Ultimate Edition (version 2020.3) • IntelliJ at C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\203.5419.21 • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart [√] Connected device (5 available) • sdk gphone x86 arm (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19041.572] • Web Server (web) • web-server • web-javascript • Flutter Tools • Chrome (web) • chrome • web-javascript • Google Chrome 86.0.4240.111 • Edge (web) • edge • web-javascript • Microsoft Edge 86.0.622.51 • No issues found! ```

Is this happening with an emulator or physical device instance? Does messaging work (the device receives notifications)? Thank you

tgpsantos commented 4 years ago

@markusaksli-nc thanks for your answer.

I have not set-up messaging as I don't have any intention of using it. I have only imported it to be able to access the instance ID required for using a Device Test in AB Testing. It's happening with a physical device.

markusaksli-nc commented 4 years ago

Based on https://github.com/firebase/firebase-ios-sdk/issues/6892#issuecomment-723117708 this is an upstream console issue.

todesignandconquer commented 3 years ago

I am having the same issue as well.

image
digosantos commented 3 years ago

Same here... Any updates?

russellwheatley commented 3 years ago

Closing this due to a lack of activity, and it is an upstream firebase-ios-sdk issue. There is nothing to action here.