Skip to content

Add limited use tokens for ai logic#1454

Open
AustinBenoit wants to merge 2 commits into
mainfrom
ailimiteduse
Open

Add limited use tokens for ai logic#1454
AustinBenoit wants to merge 2 commits into
mainfrom
ailimiteduse

Conversation

@AustinBenoit
Copy link
Copy Markdown
Contributor

Description

Provide details of the change, and generalize the change in the PR title above.

Add limited use tokens for AI logic


Testing

Describe how you've tested these changes.

Tested locally. Added to all the backends so we enforce appcheck for the


Type of Change

Place an x the applicable box:

  • Bug fix. Add the issue # below if applicable.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

@AustinBenoit AustinBenoit added the tests-requested: quick Trigger a quick set of integration tests. label May 12, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread firebaseai/src/GenerativeModel.cs
Comment thread firebaseai/src/Imagen/ImagenModel.cs

// Set the request headers
await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp);
await Firebase.Internal.HttpHelpers.SetRequestHeaders(request, _firebaseApp, limitedUseAppCheckTokens: _useLimitedUseAppCheckTokens);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been added in with functions

Comment thread firebaseai/src/TemplateGenerativeModel.cs
Comment thread firebaseai/src/Imagen/ImagenModel.cs
@AustinBenoit AustinBenoit added tests-requested: quick Trigger a quick set of integration tests. and removed tests-requested: quick Trigger a quick set of integration tests. labels May 12, 2026
@github-actions github-actions Bot added tests: in-progress This PR's integration tests are in progress. and removed tests-requested: quick Trigger a quick set of integration tests. labels May 12, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 12, 2026

❌  Integration test FAILED

Requested by @firebase-workflow-trigger[bot] on commit e7852d0
Last updated: Wed May 13 08:29 PDT 2026
View integration test log & download artifacts

Failures Configs
missing_log [TEST] [ERROR] [2021] [1/2 Build OS(s): windows] [1/5 Platform(s): Playmode] [1/2 Test Device(s): github_runner]
analytics [TEST] [FAILURE] [2021] [1/2 Build OS(s): macos] [1/5 Platform(s): 14] [1/2 Test Device(s): iOS]
firebaseai [BUILD] [ERROR] [2021] [All 2 Build OS(s)] [All 3 Platform(s)] [All 2 Test Device(s)]

@github-actions github-actions Bot added the tests: failed This PR's integration tests failed. label May 12, 2026
@firebase-workflow-trigger firebase-workflow-trigger Bot removed the tests: in-progress This PR's integration tests are in progress. label May 12, 2026
@AustinBenoit AustinBenoit requested a review from a-maurice May 13, 2026 12:26
@AustinBenoit AustinBenoit added the tests-requested: quick Trigger a quick set of integration tests. label May 13, 2026
@AustinBenoit AustinBenoit marked this pull request as ready for review May 13, 2026 12:41
@github-actions github-actions Bot added tests: in-progress This PR's integration tests are in progress. tests: failed This PR's integration tests failed. and removed tests-requested: quick Trigger a quick set of integration tests. tests: failed This PR's integration tests failed. labels May 13, 2026
@firebase-workflow-trigger firebase-workflow-trigger Bot removed the tests: in-progress This PR's integration tests are in progress. label May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests: failed This PR's integration tests failed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant