Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[firebase_auth]: An error occurs when I try to access the claims of an authenticated user #12663

Open
1 task done
luizjunior05 opened this issue Apr 17, 2024 · 2 comments
Open
1 task done
Labels
Needs Attention This issue needs maintainer attention. platform: web Issues / PRs which are specifically for web. plugin: auth type: bug Something isn't working

Comments

@luizjunior05
Copy link

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Auth

Which platforms are affected?

Web

Description

When accessing an authenticated user's payload declarations in flutter web, I receive the following error message:

══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞═════════════════════════════════════════════════════════
The following TypeErrorImpl was thrown:
Unexpected null value.

When the exception was thrown, this was the stack:
dart-sdk/lib/internal/js_dev_runtime/private/ddc_runtime/errors.dart 297:3 throw
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 806:18 nullCheck
packages/firebase_auth_web/firebase_auth_web.dart 81:41
dart-sdk/lib/async/zone.dart 1407:47 _rootRunUnary
dart-sdk/lib/async/zone.dart 1308:19 runUnary
dart-sdk/lib/async/zone.dart 1217:7 runUnaryGuarded
dart-sdk/lib/async/stream_impl.dart 339:5 [_sendData]
dart-sdk/lib/async/stream_impl.dart 271:7 [_add]
dart-sdk/lib/async/stream_pipe.dart 123:11 [_add]
dart-sdk/lib/async/stream_pipe.dart 218:9 [_handleData]
dart-sdk/lib/async/stream_pipe.dart 153:5 [_handleData]
dart-sdk/lib/async/zone.dart 1415:13 _rootRunUnary
dart-sdk/lib/async/zone.dart 1308:19 runUnary
dart-sdk/lib/async/zone.dart 1217:7 runUnaryGuarded
dart-sdk/lib/async/stream_impl.dart 339:5 [_sendData]
dart-sdk/lib/async/stream_impl.dart 271:7 [_add]
dart-sdk/lib/async/broadcast_stream_controller.dart 377:24 [_sendData]
dart-sdk/lib/async/broadcast_stream_controller.dart 244:5 add
packages/firebase_auth_web/src/interop/auth.dart 449:41
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 550:37 _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 555:39 dcall
https://www.gstatic.com/firebasejs/10.10.0/firebase-auth.js 1:5962
https://www.gstatic.com/firebasejs/10.10.0/firebase-auth.js 1:7102
════════════════════════════════════════════════════════════════════════════════════════════════════
══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞═════════════════════════════════════════════════════════
The following _TypeError was thrown:
TypeError: Instance of 'LinkedMap<Object?, Object?>': type 'LinkedMap<Object?, Object?>' is not a
subtype of type 'Map<String, dynamic>'

When the exception was thrown, this was the stack:
dart-sdk/lib/internal/js_dev_runtime/private/ddc_runtime/errors.dart 297:3 throw
dart-sdk/lib/_internal/js_shared/lib/rti.dart 1385:3 _failedAsCheck
dart-sdk/lib/_internal/js_shared/lib/rti.dart 1363:3 _generalAsCheckImplementation
.
.
.

Reproducing the issue

  • I configure firebaseoptions for my project
  • I update firebase_core and firebase_auth: firebase_core: ^2.30.0 and firebase_auth: ^4.19.2
  • I log in (signInWithEmailAndPassword) and try to access the claims through the getIdTokenResult method

Firebase Core version

2.30.0

Flutter Version

3.19.5

Relevant Log Output

No response

Flutter dependencies

Expand Flutter dependencies snippet
Dart SDK 3.3.3
Flutter SDK 3.19.5
pronapp 0.76.2

dependencies:
- dartz 0.10.1
- diacritic 0.1.5
- elegant_notification 2.1.1 [flutter]
- extended_image 8.2.0 [extended_image_library flutter meta]
- file_picker 8.0.0+1 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface ffi path win32 cross_file]
- firebase_analytics 10.10.2 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter]
- firebase_auth 4.19.2 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 2.30.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- fl_chart 0.67.0 [equatable flutter]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- flutter_form_builder 9.2.1 [flutter intl]
- flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math]
- flutter_staggered_grid_view 0.7.0 [flutter]
- form_builder_validators 9.1.0 [flutter flutter_localizations intl]
- get 4.6.6 [flutter]
- get_it 7.7.0 [async collection meta]
- go_router 13.2.4 [collection flutter flutter_web_plugins logging meta]
- google_fonts 6.2.1 [flutter http path_provider crypto]
- graphql 5.2.0-beta.7 [meta path gql gql_exec gql_link gql_http_link gql_transform_link gql_error_link gql_dedupe_link hive normalize http collection web_socket_channel stream_channel rxdart uuid]
- grpc 3.2.4 [archive async crypto fixnum googleapis_auth meta http http2 protobuf clock]
- hive 2.2.3 [meta crypto]
- hive_flutter 1.1.0 [flutter hive path_provider path]
- image_cropper 5.0.1 [flutter image_cropper_platform_interface image_cropper_for_web]
- image_network 2.5.6 [flutter http webviewimage]
- image_picker 1.1.0 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_linux image_picker_macos image_picker_platform_interface image_picker_windows]
- intl 0.19.0 [clock meta path]
- logger 2.2.0
- mask_text_input_formatter 2.9.0 [flutter]
- package_info_plus 7.0.0 [ffi flutter flutter_web_plugins http meta path package_info_plus_platform_interface web win32 clock]
- path_provider 2.1.3 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows]
- pdf 3.10.8 [archive barcode bidi crypto image meta path_parsing vector_math xml]
- printing 5.12.0 [ffi flutter flutter_web_plugins http image js meta pdf pdf_widget_wrapper plugin_platform_interface]
- protobuf 3.1.0 [collection fixnum meta]
- responsive_framework 0.2.0 [flutter collection]
- retry 3.1.2
- search_choices 2.2.7 [flutter]
- sentry_flutter 7.20.0 [flutter flutter_web_plugins sentry package_info_plus meta ffi]
- syncfusion_flutter_pdfviewer 24.2.8 [flutter vector_math async http uuid device_info_plus intl syncfusion_pdfviewer_platform_interface syncfusion_pdfviewer_web syncfusion_pdfviewer_macos syncfusion_pdfviewer_windows syncfusion_flutter_core syncfusion_flutter_pdf syncfusion_flutter_signaturepad url_launcher]
- universal_platform 1.0.0+1
- web 0.5.1

dev dependencies:
- build_runner 2.4.9 [analyzer args async build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style frontend_server_client glob graphs http_multi_server io js logging meta mime package_config path pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml]
- flutter_lints 3.0.2 [lints]
- flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math leak_tracker_flutter_testing async boolean_selector characters collection leak_tracker leak_tracker_testing material_color_utilities meta source_span stream_channel string_scanner term_glyph vm_service]
- hive_generator 2.0.1 [build source_gen hive analyzer source_helper]
- sentry_dart_plugin 1.7.1 [yaml injector ansicolor system_info2 file http crypto convert process properties]

dependency overrides:
- intl 0.19.0 [clock meta path]

transitive dependencies:
- _fe_analyzer_shared 67.0.0 [meta]
- _flutterfire_internals 1.3.30 [collection firebase_core firebase_core_platform_interface flutter meta]
- analyzer 6.4.1 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml]
- ansicolor 2.0.2
- archive 3.4.10 [crypto path pointycastle]
- args 2.5.0
- async 2.11.0 [collection meta]
- barcode 2.2.7 [meta qr]
- bidi 2.0.10
- boolean_selector 2.1.1 [source_span string_scanner]
- build 2.4.1 [analyzer async convert crypto glob logging meta package_config path]
- build_config 1.1.1 [checked_yaml json_annotation path pubspec_parse yaml]
- build_daemon 4.0.1 [built_collection built_value crypto http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher web_socket_channel]
- build_resolvers 2.4.2 [analyzer async build collection convert crypto graphs logging package_config path pool pub_semver stream_transform yaml]
- build_runner_core 7.3.0 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta package_config path pool timing watcher yaml]
- built_collection 5.1.1
- built_value 8.9.2 [built_collection collection fixnum meta]
- characters 1.3.0
- checked_yaml 2.0.3 [json_annotation source_span yaml]
- clock 1.1.1
- code_builder 4.10.0 [built_collection built_value collection matcher meta]
- collection 1.18.0
- convert 3.1.1 [typed_data]
- coverage 1.7.2 [args logging package_config path source_maps stack_trace vm_service]
- cross_file 0.3.4+1 [meta web]
- crypto 3.0.3 [typed_data]
- dart_style 2.3.6 [analyzer args collection path pub_semver source_span]
- device_info_plus 9.1.2 [device_info_plus_platform_interface ffi file flutter flutter_web_plugins meta win32 win32_registry]
- device_info_plus_platform_interface 7.0.0 [flutter meta plugin_platform_interface]
- equatable 2.0.5 [collection meta]
- extended_image_library 4.0.4 [crypto flutter http_client_helper js path path_provider web]
- fake_async 1.3.1 [clock collection]
- ffi 2.1.2
- file 7.0.0 [meta path]
- file_selector_linux 0.9.2+1 [cross_file file_selector_platform_interface flutter]
- file_selector_macos 0.9.3+3 [cross_file file_selector_platform_interface flutter]
- file_selector_platform_interface 2.6.2 [cross_file flutter http plugin_platform_interface]
- file_selector_windows 0.9.3+1 [cross_file file_selector_platform_interface flutter]
- firebase_analytics_platform_interface 3.10.3 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_analytics_web 0.5.7+2 [_flutterfire_internals firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins]
- firebase_auth_platform_interface 7.2.3 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 5.11.2 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser meta web]
- firebase_core_platform_interface 5.0.0 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 2.15.0 [firebase_core_platform_interface flutter flutter_web_plugins meta web]
- fixnum 1.1.0
- flutter_plugin_android_lifecycle 2.0.19 [flutter]
- flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math]
- frontend_server_client 3.2.0 [async path]
- glob 2.1.2 [async collection file path string_scanner]
- globbing 1.0.0 [path]
- google_identity_services_web 0.3.1+1 [meta web]
- googleapis_auth 1.6.0 [args crypto google_identity_services_web http http_parser]
- gql 1.0.1-alpha+1709845491443 [collection meta source_span yaml]
- gql_dedupe_link 2.0.4-alpha+1709845491527 [async gql_exec gql_link meta]
- gql_error_link 1.0.0+1 [async gql_exec gql_link meta]
- gql_exec 1.1.1-alpha+1699813812660 [collection gql meta]
- gql_http_link 1.0.1+1 [gql gql_exec gql_link http http_parser meta]
- gql_link 1.0.1-alpha+1709845491457 [gql gql_exec meta]
- gql_transform_link 1.0.0 [gql_exec gql_link]
- graphs 2.3.1 [collection]
- http 1.2.1 [async http_parser meta web]
- http2 2.3.0
- http_client_helper 3.0.0 [http]
- http_multi_server 3.2.1 [async]
- http_parser 4.0.2 [collection source_span string_scanner typed_data]
- image 4.1.7 [archive meta xml]
- image_cropper_for_web 3.0.0 [flutter flutter_web_plugins image_cropper_platform_interface js]
- image_cropper_platform_interface 5.0.0 [flutter plugin_platform_interface http]
- image_picker_android 0.8.10 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]
- image_picker_for_web 3.0.4 [flutter flutter_web_plugins image_picker_platform_interface mime web]
- image_picker_ios 0.8.10 [flutter image_picker_platform_interface]
- image_picker_linux 0.2.1+1 [file_selector_linux file_selector_platform_interface flutter image_picker_platform_interface]
- image_picker_macos 0.2.1+1 [file_selector_macos file_selector_platform_interface flutter image_picker_platform_interface]
- image_picker_platform_interface 2.10.0 [cross_file flutter http plugin_platform_interface]
- image_picker_windows 0.2.1+1 [file_selector_platform_interface file_selector_windows flutter image_picker_platform_interface]
- injector 3.0.0
- io 1.0.4 [meta path string_scanner]
- js 0.6.7 [meta]
- json_annotation 4.8.1 [meta]
- leak_tracker 10.0.0 [clock collection meta path vm_service]
- leak_tracker_flutter_testing 2.0.1 [flutter leak_tracker leak_tracker_testing matcher meta]
- leak_tracker_testing 2.0.1 [leak_tracker matcher meta]
- lints 3.0.0
- logging 1.2.0
- matcher 0.12.16+1 [async meta stack_trace term_glyph test_api]
- material_color_utilities 0.8.0 [collection]
- meta 1.11.0
- mime 1.0.5
- node_preamble 2.0.2
- normalize 0.8.2+1 [gql collection]
- package_config 2.1.0 [path]
- package_info_plus_platform_interface 3.0.0 [flutter meta plugin_platform_interface]
- path 1.9.0
- path_parsing 1.0.1 [vector_math meta]
- path_provider_android 2.2.4 [flutter path_provider_platform_interface]
- path_provider_foundation 2.3.2 [flutter path_provider_platform_interface]
- path_provider_linux 2.2.1 [ffi flutter path path_provider_platform_interface xdg_directories]
- path_provider_platform_interface 2.1.2 [flutter platform plugin_platform_interface]
- path_provider_windows 2.2.1 [ffi flutter path path_provider_platform_interface win32]
- pdf_widget_wrapper 1.0.3 [flutter pdf]
- petitparser 6.0.2 [meta]
- platform 3.1.4
- plugin_platform_interface 2.1.8 [meta]
- pointer_interceptor 0.10.1 [flutter flutter_web_plugins pointer_interceptor_ios pointer_interceptor_platform_interface pointer_interceptor_web]
- pointer_interceptor_ios 0.10.0+2 [flutter plugin_platform_interface pointer_interceptor_platform_interface]
- pointer_interceptor_platform_interface 0.10.0+1 [flutter plugin_platform_interface]
- pointer_interceptor_web 0.10.2 [flutter flutter_web_plugins plugin_platform_interface pointer_interceptor_platform_interface web]
- pointycastle 3.8.0 [collection convert js]
- pool 1.5.1 [async stack_trace]
- process 5.0.2 [file path platform]
- properties 2.1.0 [meta test]
- pub_semver 2.1.4 [collection meta]
- pubspec_parse 1.2.3 [checked_yaml collection json_annotation pub_semver yaml]
- qr 3.0.1 [meta]
- rxdart 0.27.7
- sentry 7.20.0 [http meta stack_trace uuid]
- shelf 1.4.1 [async collection http_parser path stack_trace stream_channel]
- shelf_packages_handler 3.0.2 [path shelf shelf_static]
- shelf_static 1.1.2 [convert http_parser mime path shelf]
- shelf_web_socket 1.0.4 [shelf stream_channel web_socket_channel]
- sky_engine 0.0.99
- source_gen 1.5.0 [analyzer async build dart_style glob path source_span yaml]
- source_helper 1.3.4 [analyzer collection source_gen]
- source_map_stack_trace 2.1.1 [path source_maps stack_trace]
- source_maps 0.10.12 [source_span]
- source_span 1.10.0 [collection path term_glyph]
- sprintf 7.0.0
- stack_trace 1.11.1 [path]
- stream_channel 2.1.2 [async]
- stream_transform 2.1.0
- string_scanner 1.2.0 [source_span]
- syncfusion_flutter_core 24.2.9 [vector_math flutter]
- syncfusion_flutter_pdf 24.2.9 [flutter intl xml syncfusion_flutter_core crypto convert]
- syncfusion_flutter_signaturepad 24.2.9 [flutter syncfusion_flutter_core]
- syncfusion_pdfviewer_macos 24.2.9 [flutter syncfusion_pdfviewer_platform_interface]
- syncfusion_pdfviewer_platform_interface 24.2.9 [flutter plugin_platform_interface]
- syncfusion_pdfviewer_web 24.2.8 [flutter flutter_web_plugins js meta syncfusion_pdfviewer_platform_interface]
- syncfusion_pdfviewer_windows 24.2.9 [flutter]
- system_info2 4.0.0 [globbing path]
- term_glyph 1.2.1
- test 1.24.9 [analyzer async boolean_selector collection coverage http_multi_server io js matcher node_preamble package_config path pool shelf shelf_packages_handler shelf_static shelf_web_socket source_span stack_trace stream_channel test_api test_core typed_data web_socket_channel webkit_inspection_protocol yaml]
- test_api 0.6.1 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph]
- test_core 0.5.9 [analyzer args async boolean_selector collection coverage frontend_server_client glob io meta package_config path pool source_map_stack_trace source_maps source_span stack_trace stream_channel test_api vm_service yaml]
- timing 1.0.1 [json_annotation]
- typed_data 1.3.2 [collection]
- url_launcher 6.2.6 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]
- url_launcher_android 6.3.1 [flutter url_launcher_platform_interface]
- url_launcher_ios 6.2.5 [flutter url_launcher_platform_interface]
- url_launcher_linux 3.1.1 [flutter url_launcher_platform_interface]
- url_launcher_macos 3.1.0 [flutter url_launcher_platform_interface]
- url_launcher_platform_interface 2.3.2 [flutter plugin_platform_interface]
- url_launcher_web 2.3.1 [flutter flutter_web_plugins url_launcher_platform_interface web]
- url_launcher_windows 3.1.1 [flutter url_launcher_platform_interface]
- uuid 4.4.0 [crypto sprintf meta fixnum]
- vector_math 2.1.4
- vm_service 13.0.0
- watcher 1.1.0 [async path]
- web_socket_channel 2.4.5 [async crypto stream_channel web]
- webkit_inspection_protocol 1.2.1 [logging]
- webview_flutter 4.7.0 [flutter webview_flutter_android webview_flutter_platform_interface webview_flutter_wkwebview]
- webview_flutter_android 3.16.0 [flutter webview_flutter_platform_interface]
- webview_flutter_platform_interface 2.10.0 [flutter meta plugin_platform_interface]
- webview_flutter_wkwebview 3.13.0 [flutter path webview_flutter_platform_interface]
- webviewimage 0.0.6 [flutter http path pointer_interceptor uuid webview_flutter]
- win32 5.4.0 [ffi]
- win32_registry 1.1.3 [ffi win32]
- xdg_directories 1.0.4 [meta path]
- xml 6.5.0 [collection meta petitparser]
- yaml 3.1.2 [collection source_span string_scanner]

Additional context and comments

Problem similar to:

Fixes: #12572

@luizjunior05 luizjunior05 added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Apr 17, 2024
@russellwheatley
Copy link
Member

@luizjunior05 - it would be helpful if you provided a code snippet on how to reproduce the bug. Thanks 🙏

@russellwheatley russellwheatley added blocked: customer-response Waiting for customer response, e.g. more information was requested. platform: web Issues / PRs which are specifically for web. plugin: auth and removed Needs Attention This issue needs maintainer attention. labels Apr 17, 2024
@luizjunior05
Copy link
Author

I managed to solve the problem.

In flutter_auth: 4.17.8 it was working normally. But when updating I started getting the error: TypeError: Instance of 'LinkedMap<Object?, Object?>': type 'LinkedMap<Object?, Object?>' is not a subtype of type 'Map<String, dynamic>'

I identified that the error occurred when trying to read the custom claims. So I changed the type of the variable that receives the value of the custom claims from Map<String, dynamic> to Map<Object?, Object?> and it worked.

I apologize for taking up your time due to lack of more attention on my part.

Thank you for your attention @russellwheatley

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Attention This issue needs maintainer attention. platform: web Issues / PRs which are specifically for web. plugin: auth type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants