Skip to content

feat(app-check): Debug token support for the activate method #16942

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

furkankurt
Copy link

@furkankurt furkankurt commented Jan 6, 2025

Description

This feature enables developers to use a pre-generated debug token rather than generating one at runtime. It is particularly beneficial in CI environments where manually copying the token from logs and pasting it into the Firebase Console is not feasible.
By using a pre-generated token, the setup becomes more automated and less error-prone, streamlining the development and testing process.
This PR is an improved version of #13101. Since the maintainer doesn't follow his PR, I wanted to improve it and open another PR. The improvements include better spelling and an added documentation section for how to add a debug token.

Related Issues

Fixes #11719

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

@thiago-salonkee
Copy link

👍 +1

@russellwheatley
Copy link
Member

@furkankurt - thank you for the PR! Looks good and something worthwhile IMO. I have asked the question to the Firebase team if this is something we can move ahead with. I will circle back when I have feedback 👍

@MirceaX2Mobile
Copy link

MirceaX2Mobile commented Jan 27, 2025

@russellwheatley Do you know when this would be accepted and merged? It's a really nice idea!

@russellwheatley
Copy link
Member

@MirceaX2Mobile - I have raised the question, I'm waiting for a response.

@furkankurt
Copy link
Author

Any update for my PR, @russellwheatley ?

@russellwheatley
Copy link
Member

@furkankurt - I'm still waiting for feedback I'm afraid. We will get an answer at some point, it'll just take a bit of time. Thank you for your patience 🙏

@jxng1
Copy link

jxng1 commented Apr 23, 2025

@russellwheatley Seems it's been a while, any new updates on this? Thanks!

@MirceaX2Mobile
Copy link

Would be nice to hear some updates, this feature would be so helpful @russellwheatley

@russellwheatley
Copy link
Member

Quick update - We're currently in discussion about this feature and how best to implement it. We're not sure about the current way to pass in the debug token, ideally, it would be passed in via some form of debug class instance rather than a separate argument (as currently implemented on this PR), but this would constitute a breaking change. I will update here once a final decision has been made 🙏

@chaudharydeepanshu
Copy link

Quick update - We're currently in discussion about this feature and how best to implement it. We're not sure about the current way to pass in the debug token, ideally, it would be passed in via some form of debug class instance rather than a separate argument (as currently implemented on this PR), but this would constitute a breaking change. I will update here once a final decision has been made 🙏

One question: Are we considering flutter web also in that discussion for this feature support?

Rightnow for flutter web we can add the script tag in the index.html to pass the debug token. I was thinking if in that new approach we could do this from dart code for web-app then it would be easier to use.

@russellwheatley
Copy link
Member

russellwheatley commented May 13, 2025

Hey @furkankurt - we have the green light for this feature. It has been agreed that the existing enum arguments for activate() will be annotated as deprecated (to be removed in a future, breaking change release next year), new arguments for android and iOS will be implemented (this is a tough one, the names as they currently stand would be ideal androidProvider and appleProvider, maybe rename them to be providerAndroid and providerApple? 🤔 ). They will follow the same pattern as webProvider which you can see here: https://github.com/firebase/flutterfire/blob/main/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/web_providers.dart#L5

Essentially an abstract base class which is extended by the different providers (e.g. for Apple; base class would be extended by these: https://github.com/firebase/flutterfire/blob/main/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/apple_provider.dart#L10-L19).

Hopefully that makes sense, let me know if you need any further information and if you are willing to continue with this PR! Thank you 😄

@furkankurt
Copy link
Author

Hey @furkankurt - we have the green light for this feature. It has been agreed that the existing enum arguments for activate() will be annotated as deprecated (to be removed in a future, breaking change release next year), new arguments for android and iOS will be implemented (this is a tough one as the names as they currently stand would be ideal androidProvider and appleProvider, maybe rename them to be providerAndroid and providerApple? 🤔 ). They will follow the same pattern as webProvider which you can see here: https://github.com/firebase/flutterfire/blob/main/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/web_providers.dart#L5

Essentially an abstract base class which is extended by the different providers (e.g. for Apple; base class would be extended by these: https://github.com/firebase/flutterfire/blob/main/packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/apple_provider.dart#L10-L19).

Hopefully that makes sense, let me know if you need any further information and if you are willing to continue with this PR! Thank you 😄

Thanks for the update @russellwheatley, I’ll go ahead and implement the updated structure:

  • Mark existing enum params as deprecated
  • Add providerAndroid, providerApple (mirroring existing webProvider)
  • Refactor with abstract classes for each platform's providers
  • Keep backwards compatibility until next major release

The naming suggestion providerAndroid / providerApple works well for me too. Will update the PR shortly 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚀 [firebase_app_check] Support passing debugToken as parameter similar to React Native App Check library
6 participants