Skip to content

docs: add limited-use App Check tokens documentation for iOS#149

Open
DjNastor wants to merge 1 commit into
firebase:mainfrom
DjNastor:djnastor-implement-limited-use-tokens
Open

docs: add limited-use App Check tokens documentation for iOS#149
DjNastor wants to merge 1 commit into
firebase:mainfrom
DjNastor:djnastor-implement-limited-use-tokens

Conversation

@DjNastor

Copy link
Copy Markdown

Summary

Add comprehensive documentation for using limited-use App Check tokens with Firebase AI Logic on iOS. This feature enhances security by restricting each App Check token to a single API request, reducing risk if a token is intercepted.

Changes

  • Added "Using Limited-Use App Check Tokens" subsection in the initialization section with working code example
  • Included benefits: single-use tokens, reduced attack surface, ideal for production applications
  • Added prerequisites for App Check configuration
  • Created SecureAIViewModel example showing production-ready implementation with limited-use tokens in SwiftUI

Why This Matters

Limited-use tokens are a best practice for production iOS applications. This documentation makes the feature discoverable and provides developers with clear, runnable examples of how to implement this security enhancement.

- Add 'Using Limited-Use App Check Tokens' section in initialization
- Include SecureAIViewModel example showing production-ready setup
- Document benefits: single-use tokens, reduced attack surface
- Add prerequisites for App Check configuration

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@google-cla

google-cla Bot commented Jul 11, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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

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.

Code Review

This pull request adds documentation and Swift code examples for using limited-use App Check tokens with Firebase AI Logic on iOS. The review feedback correctly identifies that the backend parameter .googleAI() is incorrect and should be .geminiDeveloperAPI(), and suggests adding the [AGENT] placeholder comment to the SwiftUI integration example.

Comment on lines +25 to +28
let ai = FirebaseAI.firebaseAI(
backend: .googleAI(),
useLimitedUseAppCheckTokens: true
)

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.

medium

The backend parameter .googleAI() is incorrect. According to the SKILL.md and Firebase AI Logic specifications, the supported Gemini API providers are the Gemini Developer API and Vertex AI Gemini API. The correct enum case for the Gemini Developer API is .geminiDeveloperAPI().

Suggested change
let ai = FirebaseAI.firebaseAI(
backend: .googleAI(),
useLimitedUseAppCheckTokens: true
)
let ai = FirebaseAI.firebaseAI(
backend: .geminiDeveloperAPI(),
useLimitedUseAppCheckTokens: true
)

Comment on lines +122 to +125
private lazy var model = FirebaseAI.firebaseAI(
backend: .googleAI(),
useLimitedUseAppCheckTokens: true
).generativeModel(modelName: "<latest_supported_model>")

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.

medium

The backend parameter .googleAI() is incorrect. It should be .geminiDeveloperAPI() to match the supported Gemini Developer API provider. Additionally, please add the [AGENT] comment above the model initialization so that automated agents can correctly identify and update the model name placeholder.

Suggested change
private lazy var model = FirebaseAI.firebaseAI(
backend: .googleAI(),
useLimitedUseAppCheckTokens: true
).generativeModel(modelName: "<latest_supported_model>")
// [AGENT] Replace "<latest_supported_model>" with the latest model from https://firebase.google.com/docs/ai-logic/models.md.txt
private lazy var model = FirebaseAI.firebaseAI(
backend: .geminiDeveloperAPI(),
useLimitedUseAppCheckTokens: true
).generativeModel(modelName: "<latest_supported_model>")

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.

1 participant