Repository navigation
Description
Is there an existing issue for this?
- I have searched the existing issues.
Which plugins are affected?
App Check, Core
Which platforms are affected?
iOS
Description
After upgrading from Flutter 3.47.x to 3.50.0, without changing any Dart or native code, FirebaseAppCheck.instance.activate(...) no longer takes effect on iOS. The native App Check SDK keeps the provider from its default factory instead of the one passed to activate():
- On the simulator,
AppleDebugProvider(debugToken: '<registered token>')is ignored. The SDK logs a newly generated random debug token, the exchange fails with 403 "App attestation failed.", and every request that needs App Check is rejected. - On a physical device the default factory picks DeviceCheck. If App Attest was requested, it is never used. When only App Attest is registered in the Firebase console, App Check fails for every user.
Android is not affected.
Root cause (as far as I can tell):
-
Flutter 3.50 now orders the generated plugin registrant by dependency (
sortByDependenciesinpackages/flutter_tools/lib/src/flutter_plugins.dart). Up to 3.47.x it was alphabetical. The generatedios/Runner/GeneratedPluginRegistrant.mchanged like this:Flutter 3.47.9:
[FirebaseAppCheckPlugin registerWithRegistrar:...]; [FLTFirebaseCorePlugin registerWithRegistrar:...];Flutter 3.50.0:
[FLTFirebaseCorePlugin registerWithRegistrar:...]; ... [FirebaseAppCheckPlugin registerWithRegistrar:...]; -
When
FLTFirebaseCorePluginis registered, itssharedinitializer callsFirebaseApp.configure()ifGoogleService-Info.plistis present. -
FIRAppCheckComponentusesFIRInstantiationTimingAlwaysEager, soAppCheckis created insideFirebaseApp.configure(). At that point the provider factory is still the SDK default (FIRDefaultProviderFactory: debug provider with a random token on the simulator, DeviceCheck on a device). -
FirebaseAppCheckPlugin.sharedcallsAppCheck.setAppCheckProviderFactory(FlutterAppCheckProviderFactory())only when that plugin is registered. That is now after the default app has been configured, so the factory is never used. The later Dartactivate()configuresFlutterAppCheckProviderFactory, which no instance ever asks for a provider.
Before 3.50 this only worked because "FirebaseAppCheckPlugin" sorts alphabetically before "FLTFirebaseCorePlugin". Dependency ordering is reasonable (app_check depends on core), so it seems the plugin should not rely on registering first. For example, the provider factory could be installed before FirebaseApp.configure() runs, or core could defer configuring the default app.
Reproducing the issue
- Create an app with
firebase_coreandfirebase_app_checkand aGoogleService-Info.plistin the iOS Runner target. Build with Flutter 3.50.0. - In
main():await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); await FirebaseAppCheck.instance.activate( providerApple: AppleDebugProvider(debugToken: '<a debug token registered in the console>'), ); final token = await FirebaseAppCheck.instance.getToken();
- Run on an iOS simulator.
Expected: the registered debug token is exchanged and getToken() returns a valid token, as it does on Flutter 3.47.9.
Actual: the console prints a newly generated random debug token (not the one passed to activate()), the exchange returns 403, and getToken() fails.
Check: compare ios/Runner/GeneratedPluginRegistrant.m between Flutter 3.47.9 and 3.50.0. The same project, on the same simulator, works on 3.47.9 and fails on 3.50.0.
Firebase Core version
5.1.0 (firebase_app_check 0.5.1, Firebase iOS SDK 13.1.1, Swift Package Manager)
Flutter Version
3.50.0 (works on 3.47.9 and 3.47.5)
Relevant Log Output
App Check debug token: '<random UUID, not the one passed to activate()>'
[FirebaseAppCheck][I-FAA004002] ... exchangeDebugToken ... HTTP status code: 403 ... "App attestation failed."Flutter dependencies
Expand Flutter dependencies snippet
firebase_core 5.1.0, firebase_app_check 0.5.1, firebase_analytics, firebase_crashlytics, firebase_messaging (latest at the time of writing). iOS uses Swift Package Manager (no Podfile).
Additional context and comments
This is not a duplicate of #18613 or #18665. It is the same mechanism (the default app is configured before FlutterAppCheckProviderFactory is installed, so the eager AppCheck instance keeps the SDK's default provider), but the trigger is different:
- In [firebase_app_check] iOS: activate() providers are silently ignored when FirebaseApp.configure() runs in AppDelegate (firebase-ios-sdk >= 12.15.0 default provider factory) #18613 and [firebase_app_check]: AppAttestProvider is selected, but generated App Check token appears to use DeviceCheck #18665 the app calls
FirebaseApp.configure()inAppDelegate. The documented guidance is to remove that call. - Here the app does not call
FirebaseApp.configure()natively.AppDelegatecontains no Firebase code at all. The early configure comes fromFLTFirebaseCorePluginitself, which on Flutter 3.50 is registered beforeFirebaseAppCheckPlugin. Following the documented guidance doesn't help, and there is nothing left for the app to remove.
#18950 notes that Flutter 3.50 "sorts firebase_core first" in a generated registrant. This issue is a runtime consequence of that ordering on iOS.
Workaround: stay on Flutter 3.47.x.
Activity
SelaseKay commentedon Nov 13, 2026
Hi @DouglasOGarrido, thanks for the detailed report. I'm looking into this.
SelaseKay commentedon Nov 13, 2026
Hi @DouglasOGarrido, thanks for the report.
This is valid, and your analysis of the cause is correct. The fix is in #18968.
firebase_corenow letsfirebase_app_checkinstall its provider factory before the default app is configured.We have a release scheduled for Monday. Until then, you can use the fix from the pull request branch:
Add this to your
pubspec.yaml:Run
flutter clean, thenflutter pub get, and rebuild the app.Both overrides are needed, because the change is in both packages. Please let us know if this resolves it for you.
fatihdurmaz commentedon Nov 13, 2026
Thanks for the quick response and the fix!
I applied both dependency overrides and rebuilt the app as suggested. Everything is now working correctly, and Firebase App Check successfully retrieves tokens without any errors.
I can confirm that the fix resolves the issue on my end.
Thanks again for your help and great work! 🙌
fix(app_check,apple): use the provider passed to activate() on Flutte…