useAppCheck and/or preloadAppCheck
See original GitHub issueHi, I think it would be a good idea to add useAppCheck
and/or preloadAppCheck
to provide functionality form https://firebase.google.com/docs/app-check
Version info
React: ^17.0.2
Firebase: ^8.7.1
ReactFire: ^3.0.0-rc.2
Steps to reproduce
- Add
import 'firebase/app-check'
; - Add
useFirebaseApp().appCheck().activate('YOUR KEY')
Expected behavior
I have an app check working.
Actual behavior
Uncaught FirebaseError: AppCheck: You are trying to activate AppCheck for FirebaseApp [DEFAULT], while it is already activated. AppCheck can only be activated once. (appCheck/already-activated).
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
A provider for App Check would probably be ideal. In my opinion, an
activateCallback
would be better because it would allow for more customization for individual use cases, and reduce any breaking api changes in the future if firebase changes the activate arguments.Thanks @MaciejCaputa for the feature request, and thank you @epodol for your temporary solution!
This is definitely an important feature to add to ReactFire. Let’s discuss a potential API. I wonder if we should have another Provider for AppCheck. It seems important to be able to be confident that AppCheck is activated before any calls are made that could be denied by AppCheck.
For example, it could look like:
Then, I could be confident that any Realtime Database, Cloud Storage, or Cloud Functions (callable functions) calls that I make within
<MyChatApp />
are made after AppCheck is activated.This could also be done in
FirebaseAppProvider
, but separating it out may be good to reduce bundle size for those that aren’t using AppCheck.The props for
AppCheckProvider
would likely have to account for all of the argumentsactivate
accepts:siteKeyOrProvider : string | AppCheckProvider , isTokenAutoRefreshEnabled ? : boolean
How does this sound to you? How can we make it better?