Add limited use tokens for ai logic#1454
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for limited-use App Check tokens across the Firebase AI SDK by updating the FirebaseAI instance management and propagating the configuration to all generative and image models. The reviewer identified a critical issue where several calls to SetRequestHeaders use a new parameter that is not defined in the current scope, potentially leading to compilation failures. It is recommended to replace these calls with the updated AddFirebaseTokensAsync method for consistency and correctness.
|
|
||
| // Set the request headers | ||
| await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp); | ||
| await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp, limitedUseAppCheckTokens: _useLimitedUseAppCheckTokens); |
There was a problem hiding this comment.
The HttpHelpers.SetRequestHeaders method is called with a new parameter that isn't defined in the provided changes for that class. Using FirebaseInterops.AddFirebaseTokensAsync is a viable alternative that is already updated in this PR to handle HttpRequestMessage objects.
await Firebase.Internal.FirebaseInterops.AddFirebaseTokensAsync(request, _firebaseApp, limitedUseAppCheckTokens: _useLimitedUseAppCheckTokens);There was a problem hiding this comment.
This has been added in with functions
11a2880 to
c6d44fc
Compare
❌ Integration test FAILEDRequested by @firebase-workflow-trigger[bot] on commit e7852d0
|
Description
Add limited use tokens for AI logic
Testing
Tested locally. Added to all the backends so we enforce appcheck for the
Type of Change
Place an
xthe applicable box: