vybekiit 0.7.32 → 0.7.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +5 -2
- package/dist/global-skills/aws-serverless/SKILL.md +168 -32
- package/dist/global-skills/aws-serverless/references/api-gateway.md +17 -0
- package/dist/global-skills/aws-serverless/references/architecture.md +9 -13
- package/dist/global-skills/aws-serverless/references/lambda.md +3 -3
- package/dist/global-skills/aws-serverless/references/orchestration.md +46 -20
- package/dist/global-skills/aws-serverless/references/production.md +1 -1
- package/dist/global-skills/eas-simulator/SKILL.md +15 -15
- package/dist/global-skills/eas-simulator/references/controllers.md +11 -7
- package/dist/global-skills/eas-simulator/references/run-your-app.md +8 -8
- package/dist/global-skills/eas-simulator/references/troubleshooting.md +10 -6
- package/dist/global-skills/email-best-practices/references/sending-reliability.md +17 -22
- package/dist/global-skills/extension-to-functions-codebase/SKILL.md +1 -0
- package/dist/global-skills/firebase-ai-logic-basics/SKILL.md +161 -76
- package/dist/global-skills/firebase-ai-logic-basics/references/flutter_setup.md +37 -0
- package/dist/global-skills/firebase-ai-logic-basics/references/ios_setup.md +97 -3
- package/dist/global-skills/firebase-ai-logic-basics/references/usage_patterns_android.md +88 -3
- package/dist/global-skills/firebase-ai-logic-basics/references/usage_patterns_web.md +91 -3
- package/dist/global-skills/firebase-app-hosting-basics/SKILL.md +5 -1
- package/dist/global-skills/firebase-auth-basics/SKILL.md +1 -0
- package/dist/global-skills/firebase-auth-basics/references/client_sdk_android.md +9 -9
- package/dist/global-skills/firebase-auth-basics/references/client_sdk_web.md +3 -3
- package/dist/global-skills/firebase-auth-basics/references/flutter_setup.md +22 -19
- package/dist/global-skills/firebase-auth-basics/references/security_rules.md +2 -2
- package/dist/global-skills/firebase-basics/SKILL.md +6 -2
- package/dist/global-skills/firebase-basics/references/android_setup.md +101 -37
- package/dist/global-skills/firebase-basics/references/ios_setup.md +57 -0
- package/dist/global-skills/firebase-basics/references/web_setup.md +52 -0
- package/dist/global-skills/firebase-crashlytics/SKILL.md +1 -0
- package/dist/global-skills/firebase-crashlytics/references/android_setup.md +84 -84
- package/dist/global-skills/firebase-crashlytics/references/ios_setup.md +1 -0
- package/dist/global-skills/firebase-data-connect/SKILL.md +1 -0
- package/dist/global-skills/firebase-data-connect/reference/config.md +8 -8
- package/dist/global-skills/firebase-data-connect/reference/realtime.md +4 -1
- package/dist/global-skills/firebase-data-connect/reference/sdk_android.md +33 -34
- package/dist/global-skills/firebase-data-connect/reference/sdk_web.md +8 -3
- package/dist/global-skills/firebase-data-connect/reference/security.md +13 -13
- package/dist/global-skills/firebase-firestore/SKILL.md +17 -7
- package/dist/global-skills/firebase-firestore/references/enterprise/android_sdk_usage.md +32 -32
- package/dist/global-skills/firebase-firestore/references/enterprise/indexes.md +2 -1
- package/dist/global-skills/firebase-firestore/references/standard/android_sdk_usage.md +14 -14
- package/dist/global-skills/firebase-firestore/references/standard/indexes.md +2 -1
- package/dist/global-skills/firebase-hosting-basics/SKILL.md +1 -0
- package/dist/global-skills/firebase-remote-config-basics/SKILL.md +2 -1
- package/dist/global-skills/firebase-remote-config-basics/references/android_setup.md +36 -37
- package/dist/global-skills/firebase-security-rules-auditor/SKILL.md +7 -6
- package/dist/global-skills/firestore-rules-creation/SKILL.md +22 -10
- package/dist/global-skills/neon/SKILL.md +16 -0
- package/dist/global-skills/neon-ai-gateway/SKILL.md +43 -14
- package/dist/global-skills/neon-postgres/SKILL.md +1 -1
- package/dist/global-skills/neon-postgres/references/full-text-search.md +27 -17
- package/dist/global-skills/neon-postgres/references/hybrid-search.md +19 -15
- package/dist/global-skills/neon-postgres/references/lakebase-search-drizzle.md +99 -14
- package/dist/global-skills/neon-postgres/references/vector-search.md +93 -10
- package/dist/global-skills/resend/SKILL.md +4 -15
- package/dist/global-skills/resend/references/domains.md +1 -1
- package/dist/global-skills/resend/references/installation.md +3 -3
- package/dist/global-skills/resend/references/sending/best-practices.md +3 -3
- package/dist/global-skills/resend/references/sending/single-email-examples.md +3 -3
- package/dist/global-skills/stripe-best-practices/SKILL.md +18 -18
- package/dist/global-skills/stripe-best-practices/references/tax.md +26 -14
- package/dist/global-skills/use-railway/SKILL.md +6 -6
- package/dist/global-skills/use-railway/references/iac.md +2 -1
- package/dist/global-skills/use-railway/references/tracing.md +13 -5
- package/dist/global-skills/workers-best-practices/SKILL.md +1 -1
- package/dist/global-skills/wrangler/SKILL.md +3 -3
- package/dist/global-skills/xcode-project-setup/SKILL.md +1 -0
- package/package.json +8 -8
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
# Firebase AI Logic
|
|
1
|
+
# Firebase AI Logic on Web (JavaScript)
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
The library is part of the standard Firebase Web SDK:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install firebase@latest
|
|
9
|
+
```
|
|
2
10
|
|
|
3
11
|
## Initialization Pattern
|
|
4
12
|
|
|
@@ -19,8 +27,11 @@ const firebaseConfig = {
|
|
|
19
27
|
const app = initializeApp(firebaseConfig);
|
|
20
28
|
|
|
21
29
|
// Initialize the AI Logic service (defaults to Gemini Developer API)
|
|
22
|
-
//
|
|
23
|
-
const ai = getAI(app, {
|
|
30
|
+
// Pass useLimitedUseAppCheckTokens: true to enable replay protection:
|
|
31
|
+
const ai = getAI(app, {
|
|
32
|
+
backend: new GoogleAIBackend(),
|
|
33
|
+
useLimitedUseAppCheckTokens: true,
|
|
34
|
+
});
|
|
24
35
|
|
|
25
36
|
const generationConfig = {
|
|
26
37
|
candidateCount: 1,
|
|
@@ -36,6 +47,30 @@ const generationConfig = {
|
|
|
36
47
|
const model = getGenerativeModel(ai, { model: "<latest_supported_model>", generationConfig });
|
|
37
48
|
```
|
|
38
49
|
|
|
50
|
+
### App Check Replay Protection
|
|
51
|
+
|
|
52
|
+
Generative and preview models enforce replay protection with 5-minute
|
|
53
|
+
limited-use App Check tokens. If you call a protected model without enabling
|
|
54
|
+
limited-use tokens, the request fails with:
|
|
55
|
+
|
|
56
|
+
```text
|
|
57
|
+
HTTP 403: "To access this model, you must enforce Firebase App Check"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
To resolve this error on Web, initialize `getAI` with
|
|
61
|
+
`useLimitedUseAppCheckTokens: true`:
|
|
62
|
+
|
|
63
|
+
```javascript
|
|
64
|
+
const ai = getAI(app, {
|
|
65
|
+
backend: new GoogleAIBackend(),
|
|
66
|
+
useLimitedUseAppCheckTokens: true,
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This instructs the SDK to fetch fresh, short-lived limited-use tokens (such as
|
|
71
|
+
via reCAPTCHA Enterprise or the debug provider) for requests rather than reusing
|
|
72
|
+
standard cached App Check tokens.
|
|
73
|
+
|
|
39
74
|
## Core Capabilities
|
|
40
75
|
|
|
41
76
|
Text-Only Generation
|
|
@@ -179,8 +214,61 @@ async function getJsonData(prompt) {
|
|
|
179
214
|
On-Device AI (Hybrid) Automatically switch between local Gemini Nano and cloud
|
|
180
215
|
models based on device capability.
|
|
181
216
|
|
|
217
|
+
The Firebase JavaScript SDK checks for Gemini Nano's availability (after
|
|
218
|
+
installation) and switches between on-device or cloud-hosted prompt execution.
|
|
219
|
+
This requires specific steps to enable model usage in the Chrome browser, more
|
|
220
|
+
info in the
|
|
221
|
+
[hybrid inference documentation for Web](https://firebase.google.com/docs/ai-logic/hybrid/web/get-started.md.txt).
|
|
222
|
+
|
|
182
223
|
```JavaScript
|
|
183
224
|
import {getGenerativeModel, InferenceMode } from "firebase/ai";
|
|
184
225
|
|
|
185
226
|
const hybridModel = getGenerativeModel(ai, { mode: InferenceMode.PREFER_ON_DEVICE });
|
|
186
227
|
```
|
|
228
|
+
|
|
229
|
+
## App Check
|
|
230
|
+
|
|
231
|
+
See
|
|
232
|
+
[App Check with reCAPTCHA Enterprise](https://firebase.google.com/docs/app-check/web/recaptcha-enterprise-provider.md.txt)
|
|
233
|
+
for setup instructions.
|
|
234
|
+
|
|
235
|
+
App Check debug tokens for local development and CI/CD:
|
|
236
|
+
|
|
237
|
+
- **Local development**: Set `self.FIREBASE_APPCHECK_DEBUG_TOKEN = true;` before
|
|
238
|
+
initializing App Check (generates a token in the browser console; do not
|
|
239
|
+
hardcode secret strings in client code).
|
|
240
|
+
- **CI/CD**: Pass the pre-provisioned token from the environment instead (e.g.
|
|
241
|
+
`self.FIREBASE_APPCHECK_DEBUG_TOKEN = process.env.APP_CHECK_DEBUG_TOKEN`).
|
|
242
|
+
|
|
243
|
+
### Debug Token Persistence
|
|
244
|
+
|
|
245
|
+
When testing AI Logic on Web with App Check, clearing site data, using
|
|
246
|
+
incognito/private windows, or switching browsers generates a new debug token
|
|
247
|
+
when `self.FIREBASE_APPCHECK_DEBUG_TOKEN = true` is used. To avoid this debug
|
|
248
|
+
token churn without leaking secrets into client bundles, load a stable token
|
|
249
|
+
from a gitignored local environment file:
|
|
250
|
+
|
|
251
|
+
> [!WARNING] **CRITICAL: Never Hardcode or Commit Debug Tokens** Never hardcode
|
|
252
|
+
> debug token strings in web source code. Always load them from a local,
|
|
253
|
+
> gitignored environment file.
|
|
254
|
+
|
|
255
|
+
```javascript
|
|
256
|
+
import { initializeAppCheck, ReCaptchaEnterpriseProvider } from "firebase/app-check";
|
|
257
|
+
|
|
258
|
+
if (typeof self !== "undefined") {
|
|
259
|
+
if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
|
|
260
|
+
// ✅ SAFE: Load dynamically from Next.js environment variable; fallback to true to auto-generate
|
|
261
|
+
self.FIREBASE_APPCHECK_DEBUG_TOKEN =
|
|
262
|
+
process.env.NEXT_PUBLIC_APP_CHECK_DEBUG_TOKEN || true;
|
|
263
|
+
} else if (typeof import.meta !== "undefined" && import.meta.env?.DEV) {
|
|
264
|
+
// ✅ SAFE: Load dynamically from Vite environment variable; fallback to true to auto-generate
|
|
265
|
+
self.FIREBASE_APPCHECK_DEBUG_TOKEN =
|
|
266
|
+
import.meta.env.VITE_APPCHECK_DEBUG_TOKEN || true;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const appCheck = initializeAppCheck(app, {
|
|
271
|
+
provider: new ReCaptchaEnterpriseProvider("/* reCAPTCHA site key */"),
|
|
272
|
+
isTokenAutoRefreshEnabled: true,
|
|
273
|
+
});
|
|
274
|
+
```
|
|
@@ -3,6 +3,7 @@ name: firebase-app-hosting-basics
|
|
|
3
3
|
description: >-
|
|
4
4
|
Deploys and manages full-stack web applications (Next.js, Angular) with Server-Side Rendering (SSR) using Firebase App Hosting. Use when deploying Next.js/Angular apps, configuring apphosting.yaml or firebase.json apphosting blocks, managing secrets, setting up GitHub CI/CD, or configuring Blaze billing requirements. Don't use for classic static web hosting, Auth, Firestore, Crashlytics, or Xcode.
|
|
5
5
|
metadata:
|
|
6
|
+
author: Google LLC
|
|
6
7
|
category: Serverless
|
|
7
8
|
disable-model-invocation: true
|
|
8
9
|
---
|
|
@@ -40,7 +41,7 @@ to upgrade their plan.
|
|
|
40
41
|
This is the recommended flow for most users.
|
|
41
42
|
|
|
42
43
|
1. Configure `firebase.json` with an `apphosting` block.
|
|
43
|
-
|
|
44
|
+
|
|
44
45
|
```json
|
|
45
46
|
{
|
|
46
47
|
"apphosting": {
|
|
@@ -56,12 +57,15 @@ This is the recommended flow for most users.
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
```
|
|
60
|
+
|
|
59
61
|
1. Create or edit `apphosting.yaml`- see
|
|
60
62
|
[Configuration](references/configuration.md) for more information on how to
|
|
61
63
|
do so.
|
|
64
|
+
|
|
62
65
|
1. If the app needs safe access to sensitive keys, use
|
|
63
66
|
`npx -y firebase-tools@latest apphosting:secrets` commands to set and grant
|
|
64
67
|
access to secrets.
|
|
68
|
+
|
|
65
69
|
1. Run `npx -y firebase-tools@latest deploy` when you are ready to deploy.
|
|
66
70
|
|
|
67
71
|
### Automated deployment via GitHub (CI/CD)
|
|
@@ -3,6 +3,7 @@ name: firebase-auth-basics
|
|
|
3
3
|
description: Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.
|
|
4
4
|
compatibility: This skill is best used with the Firebase CLI, but does not require it. Firebase CLI can be accessed through `npx -y firebase-tools@latest`.
|
|
5
5
|
metadata:
|
|
6
|
+
author: Google LLC
|
|
6
7
|
category: Identity
|
|
7
8
|
disable-model-invocation: true
|
|
8
9
|
---
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Firebase Authentication - Android Setup Guide (Kotlin)
|
|
2
2
|
|
|
3
|
-
This guide describes the SDK setup and basic usage patterns for
|
|
4
|
-
|
|
5
|
-
Kotlin
|
|
3
|
+
This guide describes the SDK setup and basic usage patterns for Firebase
|
|
4
|
+
Authentication in an Android app using Kotlin DSL (`build.gradle.kts`) and
|
|
5
|
+
Kotlin code.
|
|
6
6
|
|
|
7
7
|
## Prerequisites
|
|
8
8
|
|
|
@@ -30,10 +30,10 @@ ______________________________________________________________________
|
|
|
30
30
|
|
|
31
31
|
## 2. Add dependencies to Gradle build files
|
|
32
32
|
|
|
33
|
-
> [!IMPORTANT] **[AGENT] RESOLVING THE SDK VERSION DETERMINISTICALLY**
|
|
34
|
-
>
|
|
35
|
-
>
|
|
36
|
-
>
|
|
33
|
+
> [!IMPORTANT] **[AGENT] RESOLVING THE SDK VERSION DETERMINISTICALLY** Never
|
|
34
|
+
> guess or hardcode a memorized out-of-date SDK or plugin version. Before adding
|
|
35
|
+
> dependencies, you MUST query the latest available versions directly from the
|
|
36
|
+
> Google Maven Repository:
|
|
37
37
|
>
|
|
38
38
|
> ```bash
|
|
39
39
|
> # Find the latest Firebase Android BoM version
|
|
@@ -51,8 +51,8 @@ ______________________________________________________________________
|
|
|
51
51
|
> ```
|
|
52
52
|
|
|
53
53
|
In the **module (app-level)** `build.gradle.kts` (usually
|
|
54
|
-
`<project>/<app-module>/build.gradle.kts`), add the dependency for
|
|
55
|
-
|
|
54
|
+
`<project>/<app-module>/build.gradle.kts`), add the dependency for Firebase
|
|
55
|
+
Authentication:
|
|
56
56
|
|
|
57
57
|
```kotlin
|
|
58
58
|
dependencies {
|
|
@@ -76,9 +76,9 @@ signInWithPopup(auth, provider)
|
|
|
76
76
|
> it means the domain hosting your app is not authorized for OAuth operations in
|
|
77
77
|
> your Firebase project.
|
|
78
78
|
>
|
|
79
|
-
> -
|
|
80
|
-
>
|
|
81
|
-
>
|
|
79
|
+
> - **Fix**: Add your domain (e.g., `localhost` for local testing) to the
|
|
80
|
+
> Authorized Domains list in the Firebase Console (Authentication > Settings >
|
|
81
|
+
> Authorized domains).
|
|
82
82
|
> - **CRITICAL**: Do NOT include the protocol or port number when adding the
|
|
83
83
|
> domain (e.g., use `localhost`, NOT `http://localhost:9090`).
|
|
84
84
|
|
|
@@ -19,22 +19,24 @@ platform-specific quirks.
|
|
|
19
19
|
|
|
20
20
|
- **Initialization Requirement**: In 7.x, you must call
|
|
21
21
|
`await GoogleSignIn.instance.initialize();` globally before using the plugin.
|
|
22
|
+
|
|
22
23
|
- **Web Client ID Constraint**: On Flutter Web, if you call `initialize()`
|
|
23
24
|
without passing a `clientId` argument OR specifying the
|
|
24
25
|
`<meta name="google-signin-client_id" ... />` tag in `web/index.html`, the
|
|
25
26
|
Dart Web Debug Service (DWDS) and the app will throw an assertion error and
|
|
26
27
|
**hang infinitely**, resulting in a blank screen.
|
|
27
|
-
- **Common Workaround**: If you intend to use Firebase Auth's
|
|
28
|
-
`signInWithPopup(GoogleAuthProvider())` for the web, you can conditionally
|
|
29
|
-
skip the local `GoogleSignIn` package initialization entirely:
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
- **Common Workaround**: If you intend to use Firebase Auth's
|
|
30
|
+
`signInWithPopup(GoogleAuthProvider())` for the web, you can conditionally
|
|
31
|
+
skip the local `GoogleSignIn` package initialization entirely:
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
```dart
|
|
34
|
+
import 'package:flutter/foundation.dart' show kIsWeb;
|
|
35
|
+
|
|
36
|
+
if (!kIsWeb) {
|
|
37
|
+
await GoogleSignIn.instance.initialize();
|
|
38
|
+
}
|
|
39
|
+
```
|
|
38
40
|
|
|
39
41
|
## 3. Web Logout Crashes
|
|
40
42
|
|
|
@@ -43,15 +45,16 @@ platform-specific quirks.
|
|
|
43
45
|
`await GoogleSignIn.instance.signOut();` during the user's logout flow on the
|
|
44
46
|
Web platform evaluates against an uninitialized context or unsupported
|
|
45
47
|
environment, crashing the app.
|
|
46
|
-
- **Solution**: Conditionally separate the logout logic for Web to rely
|
|
47
|
-
entirely on `FirebaseAuth`:
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
- **Solution**: Conditionally separate the logout logic for Web to rely entirely
|
|
50
|
+
on `FirebaseAuth`:
|
|
51
|
+
|
|
52
|
+
```dart
|
|
53
|
+
if (!kIsWeb) {
|
|
54
|
+
await GoogleSignIn.instance.signOut();
|
|
55
|
+
}
|
|
56
|
+
await FirebaseAuth.instance.signOut();
|
|
57
|
+
```
|
|
55
58
|
|
|
56
59
|
## 4. Prototyping Workaround: Bypassing Firestore Composite Indices
|
|
57
60
|
|
|
@@ -140,8 +143,8 @@ closes.
|
|
|
140
143
|
`Sign-in failed: [firebase_auth/unauthorized-domain] This domain is not authorized for OAuth operation for your Firebase project.`
|
|
141
144
|
- **Cause**: The domain (usually `localhost` during local testing) is not listed
|
|
142
145
|
in the Authorized Domains in the Firebase Console.
|
|
143
|
-
-
|
|
144
|
-
|
|
146
|
+
- **Solution**: Add `localhost` to the Authorized Domains list in the Firebase
|
|
147
|
+
Console (Authentication > Settings > Authorized domains).
|
|
145
148
|
- **CRITICAL**: Do NOT include the protocol or port number when adding the
|
|
146
149
|
domain (e.g., use `localhost`, NOT `http://localhost:9090`). Flutter Web often
|
|
147
150
|
runs on random ports or specific ports, but Firebase Auth only cares about the
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Authentication in Security Rules
|
|
2
2
|
|
|
3
3
|
Firebase Security Rules work with Firebase Authentication to provide rule-based
|
|
4
|
-
access control. For Firestore Security Rules (`firestore.rules`), delegate to
|
|
5
|
-
`firestore-rules-author` subagent if subagent delegation is available, or
|
|
4
|
+
access control. For Firestore Security Rules (`firestore.rules`), delegate to
|
|
5
|
+
the `firestore-rules-author` subagent if subagent delegation is available, or
|
|
6
6
|
see the `firestore-rules-creation` skill otherwise. For Cloud Storage rules,
|
|
7
7
|
enable the `firebase-storage-basics` skill.
|
|
8
8
|
|
|
@@ -3,6 +3,7 @@ name: firebase-basics
|
|
|
3
3
|
description: >-
|
|
4
4
|
Provides foundational Firebase CLI setup, CLI installation, version checks (`firebase-tools@latest --version`), CLI login (including --no-localhost), project creation, project selection (`firebase use`), and app config file downloads (`google-services.json`, `GoogleService-Info.plist`). Use ONLY for CLI login, project creation/switching, or downloading app config files. Don't use for Firebase Hosting deploy, Firestore, Auth, App Hosting, Data Connect, Crashlytics, or Remote Config.
|
|
5
5
|
metadata:
|
|
6
|
+
author: Google LLC
|
|
6
7
|
category: CloudInfrastructureAndServices
|
|
7
8
|
version: "1.0.0"
|
|
8
9
|
disable-model-invocation: true
|
|
@@ -59,11 +60,13 @@ Complete these setup steps before proceeding:
|
|
|
59
60
|
- **If using an existing Project ID:**
|
|
60
61
|
|
|
61
62
|
1. Check the current project by running `npx -y firebase-tools@latest use`.
|
|
63
|
+
|
|
62
64
|
1. If the command outputs `Active Project: <project-id>`, confirm with the
|
|
63
65
|
user if this is the intended project.
|
|
66
|
+
|
|
64
67
|
1. If not, or if no project is active, set the project provided by the
|
|
65
68
|
user:
|
|
66
|
-
|
|
69
|
+
|
|
67
70
|
```bash
|
|
68
71
|
npx -y firebase-tools@latest use <PROJECT_ID>
|
|
69
72
|
```
|
|
@@ -143,8 +146,9 @@ Adhere to these principles:
|
|
|
143
146
|
|
|
144
147
|
- **Login Issues:** If the browser fails to open during the login step, use
|
|
145
148
|
`npx -y firebase-tools@latest login --no-localhost` instead.
|
|
149
|
+
|
|
146
150
|
- **Genkit:** If using Genkit, install the skills:
|
|
147
|
-
|
|
151
|
+
|
|
148
152
|
```bash
|
|
149
153
|
npx skills add genkit-ai/skills
|
|
150
154
|
```
|
|
@@ -4,34 +4,34 @@ ______________________________________________________________________
|
|
|
4
4
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
7
|
-
1.
|
|
7
|
+
1. **Firebase CLI**: Make sure the Firebase CLI is available and authenticated.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
For detailed instructions about the Firebase CLI, see
|
|
10
|
+
`firebase_basics/references/local-env-setup`. Here are high-level
|
|
11
|
+
instructions for setting up the Firebase CLI.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
1. Ensure the Firebase CLI is available:
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
```bash
|
|
16
|
+
npx -y firebase-tools@latest --version
|
|
17
|
+
```
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
1. Login to the CLI:
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
- local:
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
```bash
|
|
24
|
+
npx -y firebase-tools@latest login
|
|
25
|
+
```
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
- remote servers:
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
```bash
|
|
30
|
+
npx -y firebase-tools@latest login --no-localhost
|
|
31
|
+
```
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
1. **Android project**: Create or use an existing Android project in an
|
|
34
|
+
Android-development IDE.
|
|
35
35
|
|
|
36
36
|
______________________________________________________________________
|
|
37
37
|
|
|
@@ -63,19 +63,18 @@ ______________________________________________________________________
|
|
|
63
63
|
|
|
64
64
|
## 2. Create a new Firebase project or use an existing one
|
|
65
65
|
|
|
66
|
-
Check if there's an existing Firebase Project available for use with the
|
|
67
|
-
|
|
66
|
+
Check if there's an existing Firebase Project available for use with the Android
|
|
67
|
+
project:
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
70
|
npx -y firebase-tools@latest projects:list
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
- **If existing Firebase Project:**
|
|
74
|
-
|
|
73
|
+
- **If existing Firebase Project:** Ask the human user if they want to use the
|
|
74
|
+
existing project.
|
|
75
75
|
|
|
76
76
|
- **If no existing Firebase Project or human user does not want to use an
|
|
77
|
-
existing project:**
|
|
78
|
-
Create a new Firebase Project.
|
|
77
|
+
existing project:** Create a new Firebase Project.
|
|
79
78
|
|
|
80
79
|
Provide a required unique PROJECT_ID and an optional PROJECT_DISPLAY_NAME:
|
|
81
80
|
|
|
@@ -114,25 +113,25 @@ ______________________________________________________________________
|
|
|
114
113
|
|
|
115
114
|
## 4. Obtain and save `google-services.json`
|
|
116
115
|
|
|
117
|
-
1.
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
1. Fetch the Firebase configuration file (`google-services.json`) using the
|
|
117
|
+
Firebase Android APP_ID (which is printed in the output of the previous
|
|
118
|
+
`apps:create` command):
|
|
120
119
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
```bash
|
|
121
|
+
npx -y firebase-tools@latest apps:sdkconfig ANDROID <APP_ID> --project <PROJECT_ID>
|
|
122
|
+
```
|
|
124
123
|
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
1. Save the configuration file within the **module (app-level)** root directory
|
|
125
|
+
of the Android project: `app/google-services.json`
|
|
127
126
|
|
|
128
127
|
______________________________________________________________________
|
|
129
128
|
|
|
130
129
|
## 5. Add the `google-services` plugin
|
|
131
130
|
|
|
132
|
-
> [!IMPORTANT] **[AGENT] RESOLVING THE PLUGIN VERSION DETERMINISTICALLY**
|
|
133
|
-
>
|
|
134
|
-
>
|
|
135
|
-
>
|
|
131
|
+
> [!IMPORTANT] **[AGENT] RESOLVING THE PLUGIN VERSION DETERMINISTICALLY** Never
|
|
132
|
+
> guess or hardcode a memorized out-of-date plugin version. Before adding
|
|
133
|
+
> dependencies, you MUST query the latest available versions directly from the
|
|
134
|
+
> Google Maven Repository:
|
|
136
135
|
>
|
|
137
136
|
> ```bash
|
|
138
137
|
> # Find the latest Google services Gradle plugin version
|
|
@@ -168,6 +167,71 @@ plugins {
|
|
|
168
167
|
|
|
169
168
|
______________________________________________________________________
|
|
170
169
|
|
|
170
|
+
## 6. App Check (Debug Token Persistence)
|
|
171
|
+
|
|
172
|
+
When using App Check on Android emulators or local development,
|
|
173
|
+
`DebugAppCheckProviderFactory.getInstance()` generates a UUID token and stores
|
|
174
|
+
it in `SharedPreferences`. Wiping emulator data, clearing app storage, or fresh
|
|
175
|
+
installs generate a new UUID in Logcat, causing debug token churn in the
|
|
176
|
+
Firebase Console.
|
|
177
|
+
|
|
178
|
+
> [!WARNING] **CRITICAL: Never Hardcode or Commit Debug Tokens** App Check debug
|
|
179
|
+
> tokens allow clients to bypass attestation and access backend resources
|
|
180
|
+
> without a genuine device. **Never hardcode debug token strings in
|
|
181
|
+
> build.gradle.kts, Java, or Kotlin files, and never commit tokens to version
|
|
182
|
+
> control.** If a token is compromised, revoke it immediately in the Firebase
|
|
183
|
+
> Console.
|
|
184
|
+
|
|
185
|
+
To persist a stable debug token across emulator resets and testing without
|
|
186
|
+
committing secrets:
|
|
187
|
+
|
|
188
|
+
1. Obtain or generate a stable UUID debug token and register it in the Firebase
|
|
189
|
+
Console under **Security > App Check > Apps > Manage debug tokens**.
|
|
190
|
+
|
|
191
|
+
1. Store the token in your project's gitignored `local.properties`:
|
|
192
|
+
|
|
193
|
+
```properties
|
|
194
|
+
# In local.properties (ensure this file is in your .gitignore!)
|
|
195
|
+
APP_CHECK_DEBUG_TOKEN=<YOUR_DEBUG_TOKEN>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
1. Inject the secret in `app/build.gradle.kts` for instrumentation/testing:
|
|
199
|
+
|
|
200
|
+
```kotlin
|
|
201
|
+
val localProperties = java.util.Properties().apply {
|
|
202
|
+
val localPropertiesFile = rootProject.file("local.properties")
|
|
203
|
+
if (localPropertiesFile.exists()) {
|
|
204
|
+
load(localPropertiesFile.inputStream())
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
val appCheckDebugToken = localProperties.getProperty("APP_CHECK_DEBUG_TOKEN")
|
|
208
|
+
?: System.getenv("APP_CHECK_DEBUG_TOKEN") ?: ""
|
|
209
|
+
|
|
210
|
+
android {
|
|
211
|
+
defaultConfig {
|
|
212
|
+
// For normal emulator runs (injects into AndroidManifest)
|
|
213
|
+
manifestPlaceholders["firebaseAppCheckDebugSecret"] = appCheckDebugToken
|
|
214
|
+
|
|
215
|
+
// For instrumentation tests
|
|
216
|
+
if (appCheckDebugToken.isNotEmpty()) {
|
|
217
|
+
testInstrumentationRunnerArguments["firebaseAppCheckDebugSecret"] = appCheckDebugToken
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
1. In your application or activity, install the debug provider for debug builds:
|
|
224
|
+
|
|
225
|
+
```kotlin
|
|
226
|
+
if (BuildConfig.DEBUG) {
|
|
227
|
+
Firebase.appCheck.installAppCheckProviderFactory(
|
|
228
|
+
DebugAppCheckProviderFactory.getInstance()
|
|
229
|
+
)
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
______________________________________________________________________
|
|
234
|
+
|
|
171
235
|
## Verification plan
|
|
172
236
|
|
|
173
237
|
### Manual verification
|
|
@@ -111,3 +111,60 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
```
|
|
114
|
+
|
|
115
|
+
## 4. App Check (Debug Token Persistence)
|
|
116
|
+
|
|
117
|
+
When using App Check in local development or the iOS Simulator, the Firebase iOS
|
|
118
|
+
SDK generates a new UUID debug token whenever `NSUserDefaults` is erased (such
|
|
119
|
+
as during a simulator reset or fresh install). This causes debug token churn and
|
|
120
|
+
invalidates tokens previously registered in the Firebase console.
|
|
121
|
+
|
|
122
|
+
> [!WARNING] **CRITICAL: Never Hardcode or Commit Debug Tokens** App Check debug
|
|
123
|
+
> tokens allow clients to bypass attestation and access backend resources
|
|
124
|
+
> without a genuine device. Treat them as sensitive secrets. **Never commit
|
|
125
|
+
> debug tokens into version control or hardcode them directly into source
|
|
126
|
+
> code.** If a token is compromised, revoke it immediately in the Firebase
|
|
127
|
+
> Console.
|
|
128
|
+
|
|
129
|
+
To persist a stable debug token across simulator resets without committing
|
|
130
|
+
secrets:
|
|
131
|
+
|
|
132
|
+
1. Obtain or generate a stable UUID debug token and register it in the Firebase
|
|
133
|
+
Console under **Security > App Check > Apps > Manage debug tokens**.
|
|
134
|
+
|
|
135
|
+
1. Supply `AppCheckDebugToken` via your local environment instead of hardcoding
|
|
136
|
+
it in code:
|
|
137
|
+
|
|
138
|
+
- **Xcode Scheme Environment Variables (Recommended):**
|
|
139
|
+
|
|
140
|
+
- Select **Product > Scheme > Edit Scheme...** (or `Cmd + <`).
|
|
141
|
+
- Navigate to **Run > Arguments > Environment Variables**.
|
|
142
|
+
- Add `AppCheckDebugToken = <YOUR_DEBUG_TOKEN>`.
|
|
143
|
+
- *Tip:* Keep your personal scheme unshared or ensure user scheme data
|
|
144
|
+
(`xcuserdata/`) is included in `.gitignore` so your personal debug token
|
|
145
|
+
is not committed.
|
|
146
|
+
|
|
147
|
+
- **In Code (Only with Secure / Gitignored Loading):** If setting the
|
|
148
|
+
environment variable in code before initializing
|
|
149
|
+
`AppCheckDebugProviderFactory`, load the token dynamically from a
|
|
150
|
+
gitignored local file or build configuration—never hardcode the raw token
|
|
151
|
+
string:
|
|
152
|
+
|
|
153
|
+
```swift
|
|
154
|
+
#if DEBUG
|
|
155
|
+
// ⛔️ DO NOT hardcode literal tokens: setenv("AppCheckDebugToken", "secret-uuid", 0)
|
|
156
|
+
// ✅ SAFE: Load dynamically from a gitignored local file, xcconfig, or process environment
|
|
157
|
+
// Note: loadGitIgnoredDebugToken() is a placeholder for your custom helper (e.g., reading from a gitignored plist)
|
|
158
|
+
if let debugToken = loadGitIgnoredDebugToken() {
|
|
159
|
+
setenv("AppCheckDebugToken", debugToken, 0)
|
|
160
|
+
}
|
|
161
|
+
let providerFactory = AppCheckDebugProviderFactory()
|
|
162
|
+
AppCheck.setAppCheckProviderFactory(providerFactory)
|
|
163
|
+
#endif
|
|
164
|
+
|
|
165
|
+
FirebaseApp.configure() // Must be called AFTER setting the App Check provider factory
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Setting this environment variable avoids invalidating tokens registered in the
|
|
169
|
+
Firebase console by ensuring a consistent debug token is reused across simulator
|
|
170
|
+
resets and fresh app installs.
|
|
@@ -75,3 +75,55 @@ async function getUsers() {
|
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
```
|
|
78
|
+
|
|
79
|
+
## 5. App Check (Debug Token Persistence)
|
|
80
|
+
|
|
81
|
+
When developing locally with App Check on Web, setting
|
|
82
|
+
`self.FIREBASE_APPCHECK_DEBUG_TOKEN = true` generates a temporary UUID token in
|
|
83
|
+
the browser console and stores it in browser storage (IndexedDB). Clearing site
|
|
84
|
+
data, using incognito/private browsing, or switching browsers causes debug token
|
|
85
|
+
churn and invalidates console registration.
|
|
86
|
+
|
|
87
|
+
> [!WARNING] **CRITICAL: Never Hardcode or Commit Debug Tokens** App Check debug
|
|
88
|
+
> tokens allow clients to bypass attestation and access backend resources
|
|
89
|
+
> without a genuine client. Treat them as sensitive secrets. **Never commit
|
|
90
|
+
> debug tokens to version control or hardcode raw token strings in client
|
|
91
|
+
> files.** If a token is compromised, revoke it immediately in the Firebase
|
|
92
|
+
> Console.
|
|
93
|
+
|
|
94
|
+
To persist a stable debug token across browser resets without leaking secrets:
|
|
95
|
+
|
|
96
|
+
1. Obtain or generate a stable UUID debug token and register it in the Firebase
|
|
97
|
+
Console under **Security > App Check > Apps > Manage debug tokens**.
|
|
98
|
+
|
|
99
|
+
1. Add the token to a local, gitignored environment file (e.g. `.env.local`):
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# In .env.local (ensure this file is in your .gitignore!)
|
|
103
|
+
NEXT_PUBLIC_APP_CHECK_DEBUG_TOKEN="<YOUR_DEBUG_TOKEN>"
|
|
104
|
+
# Or for Vite:
|
|
105
|
+
# VITE_APPCHECK_DEBUG_TOKEN="<YOUR_DEBUG_TOKEN>"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
1. Configure your code before initializing App Check:
|
|
109
|
+
|
|
110
|
+
```javascript
|
|
111
|
+
import { initializeAppCheck, ReCaptchaEnterpriseProvider } from "firebase/app-check";
|
|
112
|
+
|
|
113
|
+
if (typeof self !== "undefined") {
|
|
114
|
+
if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
|
|
115
|
+
// ✅ SAFE: Load dynamically from Next.js environment variable; fallback to true to auto-generate
|
|
116
|
+
self.FIREBASE_APPCHECK_DEBUG_TOKEN =
|
|
117
|
+
process.env.NEXT_PUBLIC_APP_CHECK_DEBUG_TOKEN || true;
|
|
118
|
+
} else if (typeof import.meta !== "undefined" && import.meta.env?.DEV) {
|
|
119
|
+
// ✅ SAFE: Load dynamically from Vite environment variable; fallback to true to auto-generate
|
|
120
|
+
self.FIREBASE_APPCHECK_DEBUG_TOKEN =
|
|
121
|
+
import.meta.env.VITE_APPCHECK_DEBUG_TOKEN || true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const appCheck = initializeAppCheck(app, {
|
|
126
|
+
provider: new ReCaptchaEnterpriseProvider("/* reCAPTCHA site key */"),
|
|
127
|
+
isTokenAutoRefreshEnabled: true,
|
|
128
|
+
});
|
|
129
|
+
```
|
|
@@ -3,6 +3,7 @@ name: firebase-crashlytics
|
|
|
3
3
|
description: Comprehensive guide for Firebase Crashlytics, including provisioning and SDK usage. Use this skill when the user needs help setting up Crashlytics, adding crash reporting, or using the Crashlytics SDK in their application.
|
|
4
4
|
compatibility: This skill is best used with the Firebase CLI, but does not require it. Firebase CLI can be accessed through `npx -y firebase-tools@latest`.
|
|
5
5
|
metadata:
|
|
6
|
+
author: Google LLC
|
|
6
7
|
category: CloudObservabilityAndMonitoring
|
|
7
8
|
disable-model-invocation: true
|
|
8
9
|
---
|