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] getIdTokenResult returns null values in IdTokenResult on Windows #11768

Open
danielgorka opened this issue Oct 24, 2023 · 9 comments
Labels
blocked: firebase-sdk platform: windows Issues / PRs which are specifically for Windows. plugin: auth type: bug Something isn't working

Comments

@danielgorka
Copy link

Bug report

Describe the bug
When calling User.getIdTokenResult on Windows I've always got null values in IdTokenResult.authTime, IdTokenResult.claims.

Steps to reproduce

Steps to reproduce the behavior:

  1. Start Flutter app on Windows
  2. Sign in using signInWithEmailAndPassword
  3. Call getIdTokenResult
  4. Returned IdTokenResult has null values except token (claims, authTime etc.)

Expected behavior

Non null values in IdTokenResult.


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.13.6, on Microsoft Windows [Version 10.0.22621.2428], locale pl-PL)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.4.4)
[√] Android Studio (version 2022.3)
[√] VS Code (version 1.83.1)
[√] Connected device (5 available)
[√] Network resources

• No issues found!

Flutter dependencies

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

Click To Expand
Dart SDK 3.1.3
Flutter SDK 3.13.6
firebase_example 1.0.0+1

dependencies:
- cupertino_icons 1.0.6
- firebase_auth 4.11.1 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 2.19.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math web sky_engine]

dev dependencies:
- flutter_lints 2.0.3 [lints]
- flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math async boolean_selector characters collection material_color_utilities meta source_span stream_channel string_scanner term_glyph web]

transitive dependencies:
- _flutterfire_internals 1.3.9 [collection firebase_core firebase_core_platform_interface flutter meta]
- async 2.11.0 [collection meta]
- boolean_selector 2.1.1 [source_span string_scanner]
- characters 1.3.0
- clock 1.1.1
- collection 1.17.2
- fake_async 1.3.1 [clock collection]
- firebase_auth_platform_interface 7.0.1 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 5.8.4 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser js meta]
- firebase_core_platform_interface 5.0.0 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 2.8.1 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math web]
- http_parser 4.0.2 [collection source_span string_scanner typed_data]
- js 0.6.7 [meta]
- lints 2.1.1
- matcher 0.12.16 [async meta stack_trace term_glyph test_api]
- material_color_utilities 0.5.0 [collection]
- meta 1.9.1
- path 1.8.3
- plugin_platform_interface 2.1.6 [meta]
- sky_engine 0.0.99
- source_span 1.10.0 [collection path term_glyph]
- stack_trace 1.11.0 [path]
- stream_channel 2.1.1 [async]
- string_scanner 1.2.0 [source_span]
- term_glyph 1.2.1
- test_api 0.6.0 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph]
- typed_data 1.3.2 [collection]
- vector_math 2.1.4
- web 0.1.4-beta

@danielgorka danielgorka added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Oct 24, 2023
@darshankawar darshankawar added the triage Issue is currently being triaged. label Oct 25, 2023
@darshankawar
Copy link

Thanks for the report @danielgorka
I currently don't have windows machine to verify this, but are you running it on desktop or on mobile using windows machine ?

@darshankawar darshankawar added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Oct 25, 2023
@danielgorka
Copy link
Author

I'm running on desktop.
On mobile everything works fine.

@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 Oct 25, 2023
@darshankawar
Copy link

Thanks for the update. My colleague was able to replicate this on his Windows machine wherein it gave below results:

flutter: token info: null

        print('token info: ${token?.authTime}');
        print('token info: ${token?.claims}');
        print('token info: ${token?.expirationTime}');
        print('token info: ${token?.issuedAtTime}');
@darshankawar
Copy link

/cc @Lyokone

@darshankawar darshankawar added plugin: auth platform: windows Issues / PRs which are specifically for Windows. and removed Needs Attention This issue needs maintainer attention. triage Issue is currently being triaged. labels Oct 26, 2023
@Lyokone
Copy link
Contributor

Lyokone commented Oct 26, 2023

Hi @danielgorka, this is a missing feature from the native C++ SDK. I'll report that to the internal team.

@danielgorka
Copy link
Author

Thank you for your quick attention to this. Looking forward to the update.

@perret123
Copy link

+1 for this issue.
As AppCheck and Callable Cloud Functions are not fully supported on all plattforms yet, I built a cloud function which accepts an authToken in the request, but this doesn't work out on Windows because of this issue. So I would also look forward to a fix 👍
Thank you.

@jlundlumination
Copy link

Can't remember where i saw this but as a temporary fix until this is patched you can decode the token using https://pub.dev/packages/jwt_decoder and extract the claims

claimsMap = JwtDecoder.decode(
          (await getCurrentUser().getIdTokenResult()).toString());
@TarekkMA
Copy link
Contributor

#11949 (comment)

Opened an issue on the C++ repository for support: firebase/firebase-cpp-sdk#1494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: firebase-sdk platform: windows Issues / PRs which are specifically for Windows. plugin: auth type: bug Something isn't working
7 participants