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_app_check]: Firebase AppCheck Token Retrieval Issue on iOS #13438

Closed
1 task done
synstin opened this issue Oct 1, 2024 · 5 comments
Closed
1 task done

[firebase_app_check]: Firebase AppCheck Token Retrieval Issue on iOS #13438

synstin opened this issue Oct 1, 2024 · 5 comments
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. closed-by-bot platform: ios Issues / PRs which are specifically for iOS. plugin: app_check Stale Issue with no recent activity type: question A question where further information is requested

Comments

@synstin
Copy link

synstin commented Oct 1, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

App Check

Which platforms are affected?

iOS

Description

We are experiencing significant delays in retrieving Firebase AppCheck tokens on iOS devices. The token retrieval process is taking between 300ms to 500ms, which seems unusually slow compared to the performance on Android devices. This delay occurs consistently, even when retrieving cached tokens.

Reproducing the issue

Implement Firebase AppCheck in an iOS application.
Measure the time taken to retrieve an AppCheck token.
Repeat the token retrieval process multiple times.
Compare the results with the same process on an Android device.
Observations:

iOS devices (both simulator and real devices in release mode) consistently show 300-500ms retrieval times.
Android devices show an initial delay, but subsequent retrievals are much faster (1-10ms).
The slow retrieval on iOS persists even when fetching the same (presumably cached) token.

Test Environment:

iOS Version: 18.0
Tested on both iOS simulator and real devices in release mode

Firebase Core version

3.6.0

Flutter Version

3.24.3

Relevant Log Output

IOS


flutter:     await FirebaseAppCheck.instance.getToken()
    elapsedMilliseconds: 446ms
flutter:     await FirebaseAppCheck.instance.getToken()
    elapsedMilliseconds: 536ms
flutter:     await FirebaseAppCheck.instance.getToken()
    elapsedMilliseconds: 512ms
flutter:     await FirebaseAppCheck.instance.getToken()
    elapsedMilliseconds: 322ms
flutter:     await FirebaseAppCheck.instance.getToken()
    elapsedMilliseconds: 466ms
flutter:     await FirebaseAppCheck.instance.getToken()
    elapsedMilliseconds: 255ms

ANDROID

I/flutter ( 8473):     await FirebaseAppCheck.instance.getToken()
I/flutter ( 8473):     elapsedMilliseconds: 87ms
I/flutter ( 8473):     
I/flutter ( 8473):     await FirebaseAppCheck.instance.getToken()
I/flutter ( 8473):     elapsedMilliseconds: 2ms
I/flutter ( 8473):     
I/flutter ( 8473):     await FirebaseAppCheck.instance.getToken()
I/flutter ( 8473):     elapsedMilliseconds: 1ms
await FirebaseAppCheck.instance.getToken()
I/flutter ( 8473):     elapsedMilliseconds: 1ms
I/flutter ( 8473):     
I/flutter ( 8473):     await FirebaseAppCheck.instance.getToken()
I/flutter ( 8473):     elapsedMilliseconds: 1ms
I/flutter ( 8473):     
I/flutter ( 8473):     await FirebaseAppCheck.instance.getToken()
I/flutter ( 8473):     elapsedMilliseconds: 20ms
I/flutter ( 8473):     
I/flutter ( 8473):     await FirebaseAppCheck.instance.getToken()
I/flutter ( 8473):     elapsedMilliseconds: 1ms


### Flutter dependencies

  # firebase
  firebase_core: 3.6.0
  firebase_database: 11.1.4
  firebase_messaging: 15.1.3
  firebase_analytics: 11.3.3
  firebase_app_check: 0.3.1+3

### Additional context and comments

This issue significantly impacts the performance of our app on iOS devices.
The stark difference between iOS and Android performance is concerning.
We've tested this on both the iOS simulator and real devices in release mode, with consistent results.
We're unsure if this is expected behavior for Firebase AppCheck on iOS or if it's an anomaly.
Any insights into the cause of this discrepancy or suggestions for improving token retrieval speed on iOS would be greatly appreciated.
If this is normal behavior, we'd like to understand why there's such a significant difference between iOS and Android performance.
@synstin synstin added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Oct 1, 2024
@SelaseKay SelaseKay added platform: ios Issues / PRs which are specifically for iOS. plugin: app_check labels Oct 1, 2024
@synstin synstin changed the title [AppCheck]: Firebase AppCheck Token Retrieval Issue on iOS [firebase_app_check]: Firebase AppCheck Token Retrieval Issue on iOS Oct 3, 2024
@marcellocamara

This comment was marked as off-topic.

@edugemini

This comment was marked as off-topic.

@russellwheatley
Copy link
Member

hi @synstin - not sure there is a tremendous amount we can do about this. FlutterFire is just a wrapper around the firebase-ios-sdk and just calls

If you wish, you could check a pure iOS implementation time frame using this repo I use to reproduce firebase iOS bugs: https://github.com/russellwheatley/firebase-ios-reproduction/tree/main

You could change this code here to call FirebaseAppCheck getToken(): https://github.com/russellwheatley/firebase-ios-reproduction/blob/main/firebase-ios-reproduction/ViewController.m#L23-L64

Also - remember to change the GoogleService-Info.plist to your project here: https://github.com/russellwheatley/firebase-ios-reproduction/blob/main/GoogleService-Info.plist

And finally, add FirebaseAppCheck pod to Podfile: https://github.com/russellwheatley/firebase-ios-reproduction/blob/main/Podfile#L10

@russellwheatley russellwheatley added blocked: customer-response Waiting for customer response, e.g. more information was requested. type: question A question where further information is requested and removed Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Nov 6, 2024
@google-oss-bot google-oss-bot added the Stale Issue with no recent activity label Nov 15, 2024
@google-oss-bot
Copy link

Hey @synstin. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot
Copy link

Since there haven't been any recent updates here, I am going to close this issue.

@synstin if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. closed-by-bot platform: ios Issues / PRs which are specifically for iOS. plugin: app_check Stale Issue with no recent activity type: question A question where further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants