vybekiit 0.7.29 → 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 +3407 -2769
- package/dist/global-guidance/language.md +7 -102
- package/dist/global-skills/add-ai/SKILL.md +7 -8
- package/dist/global-skills/add-analytics/SKILL.md +4 -7
- package/dist/global-skills/add-app-clip/SKILL.md +1 -0
- package/dist/global-skills/add-blog/SKILL.md +4 -7
- package/dist/global-skills/add-files/SKILL.md +4 -7
- package/dist/global-skills/add-images/SKILL.md +4 -7
- package/dist/global-skills/add-language/SKILL.md +5 -8
- package/dist/global-skills/add-notifications/SKILL.md +4 -7
- package/dist/global-skills/add-realtime/SKILL.md +4 -7
- package/dist/global-skills/add-search/SKILL.md +4 -7
- package/dist/global-skills/add-signin/SKILL.md +4 -8
- package/dist/global-skills/add-teams/SKILL.md +4 -7
- package/dist/global-skills/aws-cdk/SKILL.md +1 -0
- package/dist/global-skills/aws-cloudformation/SKILL.md +1 -0
- package/dist/global-skills/aws-serverless/SKILL.md +169 -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/compute-decision-edge-cases.md +77 -0
- 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/better-auth-best-practices/SKILL.md +1 -0
- package/dist/global-skills/better-auth-security-best-practices/SKILL.md +1 -0
- package/dist/global-skills/building-native-ui/SKILL.md +1 -0
- package/dist/global-skills/buy-domain/SKILL.md +4 -7
- package/dist/global-skills/check-safety/SKILL.md +5 -8
- package/dist/global-skills/claimable-postgres/SKILL.md +1 -0
- package/dist/global-skills/configure-capabilities/SKILL.md +1 -1
- package/dist/global-skills/connect-account/SKILL.md +1 -1
- package/dist/global-skills/create-auth-skill/SKILL.md +1 -0
- package/dist/global-skills/doctor/SKILL.md +1 -1
- package/dist/global-skills/eas-app-stores/SKILL.md +2 -1
- package/dist/global-skills/eas-app-stores/agents/openai.yaml +1 -1
- package/dist/global-skills/eas-hosting/SKILL.md +2 -1
- package/dist/global-skills/eas-hosting/agents/openai.yaml +1 -1
- package/dist/global-skills/eas-observe/SKILL.md +2 -1
- package/dist/global-skills/eas-observe/agents/openai.yaml +1 -1
- package/dist/global-skills/eas-simulator/SKILL.md +24 -16
- package/dist/global-skills/eas-simulator/agents/openai.yaml +1 -1
- package/dist/global-skills/eas-simulator/references/controllers.md +11 -7
- package/dist/global-skills/eas-simulator/references/logs-and-crashes.md +101 -0
- package/dist/global-skills/eas-simulator/references/run-your-app.md +8 -8
- package/dist/global-skills/eas-simulator/references/troubleshooting.md +14 -6
- package/dist/global-skills/eas-update/SKILL.md +2 -1
- package/dist/global-skills/eas-update/agents/openai.yaml +1 -1
- package/dist/global-skills/eas-update-insights/SKILL.md +2 -1
- package/dist/global-skills/eas-update-insights/agents/openai.yaml +1 -1
- package/dist/global-skills/eas-workflows/SKILL.md +2 -1
- package/dist/global-skills/eas-workflows/agents/openai.yaml +1 -1
- package/dist/global-skills/email-best-practices/SKILL.md +1 -0
- package/dist/global-skills/email-best-practices/references/sending-reliability.md +17 -22
- package/dist/global-skills/expo-animation/SKILL.md +2 -1
- package/dist/global-skills/expo-api-routes/SKILL.md +1 -0
- package/dist/global-skills/expo-app-clip/SKILL.md +2 -1
- package/dist/global-skills/expo-brownfield/SKILL.md +2 -1
- package/dist/global-skills/expo-cicd-workflows/SKILL.md +1 -0
- package/dist/global-skills/expo-data-fetching/SKILL.md +2 -1
- package/dist/global-skills/expo-deployment/SKILL.md +1 -0
- package/dist/global-skills/expo-design-system/SKILL.md +2 -1
- package/dist/global-skills/expo-dev-client/SKILL.md +2 -1
- package/dist/global-skills/expo-dom/SKILL.md +2 -1
- package/dist/global-skills/expo-examples/SKILL.md +2 -1
- package/dist/global-skills/expo-migrate-module/SKILL.md +2 -1
- package/dist/global-skills/expo-module/SKILL.md +2 -1
- package/dist/global-skills/expo-native-ui/SKILL.md +2 -1
- package/dist/global-skills/expo-observe/SKILL.md +1 -0
- package/dist/global-skills/expo-overview/SKILL.md +2 -1
- package/dist/global-skills/expo-project-structure/SKILL.md +2 -1
- package/dist/global-skills/expo-router/SKILL.md +2 -1
- package/dist/global-skills/expo-skill-eval/SKILL.md +1 -0
- package/dist/global-skills/expo-skill-feedback/SKILL.md +1 -0
- package/dist/global-skills/expo-tailwind-setup/SKILL.md +1 -0
- package/dist/global-skills/expo-ui/SKILL.md +2 -1
- package/dist/global-skills/expo-upgrade/SKILL.md +2 -1
- package/dist/global-skills/expo-web-to-native/SKILL.md +2 -1
- package/dist/global-skills/extension-to-functions-codebase/SKILL.md +2 -0
- package/dist/global-skills/firebase-ai-logic-basics/SKILL.md +162 -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/tts_generation.md +676 -0
- 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 +6 -1
- package/dist/global-skills/firebase-auth-basics/SKILL.md +12 -6
- package/dist/global-skills/firebase-auth-basics/references/client_sdk_android.md +61 -23
- 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 +8 -2
- package/dist/global-skills/firebase-basics/references/android_setup.md +229 -23
- 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 +2 -0
- package/dist/global-skills/firebase-crashlytics/references/android_setup.md +99 -71
- package/dist/global-skills/firebase-crashlytics/references/ios_setup.md +1 -0
- package/dist/global-skills/firebase-data-connect/SKILL.md +2 -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 +84 -29
- 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 +18 -7
- package/dist/global-skills/firebase-firestore/references/enterprise/android_sdk_usage.md +47 -21
- package/dist/global-skills/firebase-firestore/references/enterprise/indexes.md +2 -1
- package/dist/global-skills/firebase-firestore/references/standard/android_sdk_usage.md +63 -27
- package/dist/global-skills/firebase-firestore/references/standard/indexes.md +2 -1
- package/dist/global-skills/firebase-hosting-basics/SKILL.md +2 -0
- package/dist/global-skills/firebase-remote-config-basics/SKILL.md +3 -1
- package/dist/global-skills/firebase-remote-config-basics/references/android_setup.md +83 -92
- package/dist/global-skills/firebase-security-rules-auditor/SKILL.md +8 -6
- package/dist/global-skills/firestore-rules-creation/SKILL.md +23 -10
- package/dist/global-skills/go-live/SKILL.md +7 -7
- package/dist/global-skills/harden/SKILL.md +7 -10
- package/dist/global-skills/instrument-feature-flags/SKILL.md +1 -0
- package/dist/global-skills/instrument-product-analytics/SKILL.md +1 -0
- package/dist/global-skills/manifest.json +2 -1
- package/dist/global-skills/mongodb-atlas-stream-processing/SKILL.md +1 -0
- package/dist/global-skills/mongodb-connection/SKILL.md +1 -0
- package/dist/global-skills/mongodb-mcp-setup/SKILL.md +1 -0
- package/dist/global-skills/mongodb-natural-language-querying/SKILL.md +1 -0
- package/dist/global-skills/mongodb-qe-size-estimation/SKILL.md +224 -0
- package/dist/global-skills/mongodb-query-optimizer/SKILL.md +1 -0
- package/dist/global-skills/mongodb-schema-design/SKILL.md +1 -0
- package/dist/global-skills/mongodb-search-and-ai/SKILL.md +1 -0
- package/dist/global-skills/native-data-fetching/SKILL.md +1 -0
- package/dist/global-skills/neon/SKILL.md +34 -5
- package/dist/global-skills/neon-ai-gateway/SKILL.md +44 -14
- package/dist/global-skills/neon-auth/SKILL.md +1 -0
- package/dist/global-skills/neon-functions/SKILL.md +12 -0
- package/dist/global-skills/neon-functions/references/native-binaries.md +188 -0
- package/dist/global-skills/neon-object-storage/SKILL.md +1 -0
- package/dist/global-skills/neon-postgres/SKILL.md +2 -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/neon-postgres-branches/SKILL.md +1 -0
- package/dist/global-skills/neon-postgres-egress-optimizer/SKILL.md +1 -0
- package/dist/global-skills/onboarding/SKILL.md +14 -13
- package/dist/global-skills/plan-my-idea/SKILL.md +1 -1
- package/dist/global-skills/publish-app/SKILL.md +1 -1
- package/dist/global-skills/publish-extension/SKILL.md +1 -1
- package/dist/global-skills/resend/SKILL.md +5 -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/resend/references/webhooks.md +2 -0
- package/dist/global-skills/reset-password/SKILL.md +4 -6
- package/dist/global-skills/save-data/SKILL.md +3 -0
- package/dist/global-skills/sentry-sdk-setup/SKILL.md +1 -0
- package/dist/global-skills/sentry-workflow/SKILL.md +1 -0
- package/dist/global-skills/setup-email/SKILL.md +7 -8
- package/dist/global-skills/setup-payments/SKILL.md +10 -12
- package/dist/global-skills/setup-sms/SKILL.md +1 -1
- package/dist/global-skills/sign-in-with-email-link/SKILL.md +4 -6
- package/dist/global-skills/sign-in-with-google/SKILL.md +14 -13
- package/dist/global-skills/sign-in-with-phone/SKILL.md +5 -7
- package/dist/global-skills/stripe-best-practices/SKILL.md +20 -19
- package/dist/global-skills/stripe-best-practices/references/billing.md +2 -0
- package/dist/global-skills/stripe-best-practices/references/payments.md +1 -1
- package/dist/global-skills/stripe-best-practices/references/tax.md +27 -15
- package/dist/global-skills/supabase/CHANGELOG.md +19 -0
- package/dist/global-skills/supabase/SKILL.md +1 -0
- package/dist/global-skills/supabase-postgres-best-practices/SKILL.md +1 -0
- package/dist/global-skills/track-errors/SKILL.md +12 -13
- package/dist/global-skills/update-kit/SKILL.md +1 -1
- package/dist/global-skills/upgrading-expo/SKILL.md +1 -0
- package/dist/global-skills/use-dom/SKILL.md +1 -0
- package/dist/global-skills/use-railway/SKILL.md +9 -8
- package/dist/global-skills/use-railway/references/configure.md +34 -1
- package/dist/global-skills/use-railway/references/iac.md +3 -0
- package/dist/global-skills/use-railway/references/tracing.md +97 -44
- package/dist/global-skills/vercel-composition-patterns/SKILL.md +1 -0
- package/dist/global-skills/vercel-react-best-practices/SKILL.md +1 -0
- package/dist/global-skills/vybekiitReferences/backend/AGENTS.md +11 -3
- package/dist/global-skills/vybekiitReferences/backend/agent/goal-index.md +1 -1
- package/dist/global-skills/vybekiitReferences/backend/agent/goal-routes.json +229 -0
- package/dist/global-skills/vybekiitReferences/backend/agent/mcp-setup.md +11 -2
- package/dist/global-skills/vybekiitReferences/backend/agent/session-bootstrap.md +1 -1
- package/dist/global-skills/vybekiitReferences/backend/agent/tech-references.md +1 -1
- package/dist/global-skills/vybekiitReferences/backend/language.md +7 -102
- package/dist/global-skills/vybekiitReferences/backend/platform-skills/deploy-railway-vybekiit.md +2 -2
- package/dist/global-skills/vybekiitReferences/backend/platform-skills/extend-capabilities-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/backend/platform-skills/mongodb-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/extension/AGENTS.md +11 -3
- package/dist/global-skills/vybekiitReferences/extension/agent/goal-index.md +1 -1
- package/dist/global-skills/vybekiitReferences/extension/agent/goal-routes.json +239 -0
- package/dist/global-skills/vybekiitReferences/extension/agent/mcp-setup.md +10 -1
- package/dist/global-skills/vybekiitReferences/extension/agent/session-bootstrap.md +1 -1
- package/dist/global-skills/vybekiitReferences/extension/agent/tech-references.md +1 -1
- package/dist/global-skills/vybekiitReferences/extension/agent/ui-sources.md +11 -8
- package/dist/global-skills/vybekiitReferences/extension/language.md +7 -92
- package/dist/global-skills/vybekiitReferences/extension/platform-skills/browser-automation-vybekiit.md +9 -1
- package/dist/global-skills/vybekiitReferences/extension/platform-skills/env-secrets-vybekiit.md +1 -0
- package/dist/global-skills/vybekiitReferences/extension/platform-skills/extend-capabilities-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/extension/platform-skills/observability-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/extension/platform-skills/sentry-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/mobile/AGENTS.md +27 -12
- package/dist/global-skills/vybekiitReferences/mobile/agent/goal-index.md +1 -1
- package/dist/global-skills/vybekiitReferences/mobile/agent/goal-routes.json +279 -0
- package/dist/global-skills/vybekiitReferences/mobile/agent/mcp-setup.md +10 -1
- package/dist/global-skills/vybekiitReferences/mobile/agent/session-bootstrap.md +1 -1
- package/dist/global-skills/vybekiitReferences/mobile/agent/tech-references.md +1 -1
- package/dist/global-skills/vybekiitReferences/mobile/agent/ui-sources.mobile.md +1 -1
- package/dist/global-skills/vybekiitReferences/mobile/language.md +7 -93
- package/dist/global-skills/vybekiitReferences/mobile/platform-skills/env-secrets-vybekiit.md +1 -0
- package/dist/global-skills/vybekiitReferences/mobile/platform-skills/extend-capabilities-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/mobile/platform-skills/i18n-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/mobile/platform-skills/observability-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/mobile/platform-skills/sentry-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/mobile/platform-skills/ui-port-from-web-vybekiit.md +2 -2
- package/dist/global-skills/vybekiitReferences/spa/AGENTS.md +11 -3
- package/dist/global-skills/vybekiitReferences/spa/agent/goal-index.md +1 -1
- package/dist/global-skills/vybekiitReferences/spa/agent/goal-routes.json +267 -0
- package/dist/global-skills/vybekiitReferences/spa/agent/mcp-setup.md +10 -1
- package/dist/global-skills/vybekiitReferences/spa/agent/session-bootstrap.md +1 -1
- package/dist/global-skills/vybekiitReferences/spa/agent/ui-sources.md +11 -8
- package/dist/global-skills/vybekiitReferences/spa/language.md +7 -11
- package/dist/global-skills/vybekiitReferences/web/AGENTS.md +15 -30
- package/dist/global-skills/vybekiitReferences/web/agent/goal-index.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/agent/goal-routes.json +366 -0
- package/dist/global-skills/vybekiitReferences/web/agent/mcp-setup.md +11 -2
- package/dist/global-skills/vybekiitReferences/web/agent/session-bootstrap.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/language.md +7 -102
- package/dist/global-skills/vybekiitReferences/web/platform-skills/ai-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/analytics-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/assets-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/better-auth-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/browser-automation-vybekiit.md +9 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/cms-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/compliance-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/deploy-github-pages-vybekiit.md +2 -2
- package/dist/global-skills/vybekiitReferences/web/platform-skills/deploy-railway-vybekiit.md +2 -2
- package/dist/global-skills/vybekiitReferences/web/platform-skills/deploy-vercel-vybekiit.md +2 -2
- package/dist/global-skills/vybekiitReferences/web/platform-skills/env-secrets-vybekiit.md +1 -0
- package/dist/global-skills/vybekiitReferences/web/platform-skills/extend-capabilities-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/i18n-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/jobs-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/kv-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/lemon-squeezy-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/mongodb-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/notifications-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/observability-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/paypal-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/realtime-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/registrar-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/search-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/sentry-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/seo-vybekiit.md +1 -3
- package/dist/global-skills/vybekiitReferences/web/platform-skills/supabase-vybekiit.md +1 -1
- package/dist/global-skills/vybekiitReferences/web/platform-skills/tenancy-vybekiit.md +1 -1
- package/dist/global-skills/web-to-native/SKILL.md +1 -0
- package/dist/global-skills/workers-best-practices/SKILL.md +5 -4
- package/dist/global-skills/workers-best-practices/references/configuration.md +1 -1
- package/dist/global-skills/workers-best-practices/references/platform-apis.md +5 -5
- package/dist/global-skills/workers-best-practices/references/runtime-patterns.md +1 -1
- package/dist/global-skills/wrangler/SKILL.md +28 -25
- package/dist/global-skills/xcode-project-setup/SKILL.md +2 -0
- package/package.json +10 -8
|
@@ -38,9 +38,9 @@ In your Activity or Fragment, initialize the `FirebaseAI` service and generate
|
|
|
38
38
|
content using a Gemini model:
|
|
39
39
|
|
|
40
40
|
```kotlin
|
|
41
|
-
import com.google.firebase.ai.FirebaseAI
|
|
42
41
|
import com.google.firebase.Firebase
|
|
43
42
|
import com.google.firebase.ai.ai
|
|
43
|
+
import com.google.firebase.ai.type.GenerativeBackend
|
|
44
44
|
|
|
45
45
|
class MainActivity : AppCompatActivity() {
|
|
46
46
|
|
|
@@ -48,8 +48,11 @@ class MainActivity : AppCompatActivity() {
|
|
|
48
48
|
super.onCreate(savedInstanceState)
|
|
49
49
|
setContentView(R.layout.activity_main)
|
|
50
50
|
|
|
51
|
-
// Initialize
|
|
52
|
-
val ai = Firebase.ai
|
|
51
|
+
// Initialize with replay protection using limited-use App Check tokens:
|
|
52
|
+
val ai = Firebase.ai(
|
|
53
|
+
backend = GenerativeBackend.googleAI(),
|
|
54
|
+
useLimitedUseAppCheckTokens = true
|
|
55
|
+
)
|
|
53
56
|
|
|
54
57
|
// [AGENT] Replace "<latest_supported_model>" with the latest model from https://firebase.google.com/docs/ai-logic/models.md.txt
|
|
55
58
|
val model = ai.generativeModel("<latest_supported_model>")
|
|
@@ -67,6 +70,30 @@ class MainActivity : AppCompatActivity() {
|
|
|
67
70
|
}
|
|
68
71
|
```
|
|
69
72
|
|
|
73
|
+
#### App Check Replay Protection on Android
|
|
74
|
+
|
|
75
|
+
Generative and preview models enforce replay protection using short-lived
|
|
76
|
+
(5-minute) limited-use App Check tokens to prevent replay attacks. If you call a
|
|
77
|
+
model enforcing replay protection without limited-use tokens, the request is
|
|
78
|
+
rejected with:
|
|
79
|
+
|
|
80
|
+
```text
|
|
81
|
+
HTTP 403: "To access this model, you must enforce Firebase App Check"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
To resolve this on Android, pass `useLimitedUseAppCheckTokens = true` when
|
|
85
|
+
calling `Firebase.ai`:
|
|
86
|
+
|
|
87
|
+
```kotlin
|
|
88
|
+
val ai = Firebase.ai(
|
|
89
|
+
backend = GenerativeBackend.googleAI(),
|
|
90
|
+
useLimitedUseAppCheckTokens = true
|
|
91
|
+
)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This ensures the SDK requests fresh limited-use tokens (via Play Integrity or
|
|
95
|
+
the debug provider) for each request instead of reusing cached tokens.
|
|
96
|
+
|
|
70
97
|
#### Jetpack Compose (Modern)
|
|
71
98
|
|
|
72
99
|
Initialize inside a `ComponentActivity` and use `setContent`:
|
|
@@ -155,3 +182,61 @@ lifecycleScope.launch {
|
|
|
155
182
|
}
|
|
156
183
|
}
|
|
157
184
|
```
|
|
185
|
+
|
|
186
|
+
______________________________________________________________________
|
|
187
|
+
|
|
188
|
+
### 6. App Check Debug Provider
|
|
189
|
+
|
|
190
|
+
For App Check debug tokens during local development and CI/CD, install
|
|
191
|
+
`DebugAppCheckProviderFactory.getInstance()` as the App Check provider factory
|
|
192
|
+
in debug builds:
|
|
193
|
+
|
|
194
|
+
```kotlin
|
|
195
|
+
if (BuildConfig.DEBUG) {
|
|
196
|
+
Firebase.appCheck.installAppCheckProviderFactory(
|
|
197
|
+
DebugAppCheckProviderFactory.getInstance()
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### Debug Token Persistence
|
|
203
|
+
|
|
204
|
+
Emulator resets or clearing app storage erase `SharedPreferences`, causing
|
|
205
|
+
`DebugAppCheckProviderFactory` to print a new debug token in Logcat. To persist
|
|
206
|
+
a stable debug token across emulator resets and fresh installs without
|
|
207
|
+
hardcoding secrets:
|
|
208
|
+
|
|
209
|
+
> [!WARNING] **CRITICAL: Never Hardcode or Commit Debug Tokens** Never hardcode
|
|
210
|
+
> debug token strings in `build.gradle.kts` or Kotlin source files. Store the
|
|
211
|
+
> token in gitignored `local.properties` and inject it dynamically.
|
|
212
|
+
|
|
213
|
+
1. In gitignored `local.properties`:
|
|
214
|
+
|
|
215
|
+
```properties
|
|
216
|
+
APP_CHECK_DEBUG_TOKEN=<YOUR_DEBUG_TOKEN>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
1. In `app/build.gradle.kts`:
|
|
220
|
+
|
|
221
|
+
```kotlin
|
|
222
|
+
val localProperties = java.util.Properties().apply {
|
|
223
|
+
val localPropertiesFile = rootProject.file("local.properties")
|
|
224
|
+
if (localPropertiesFile.exists()) {
|
|
225
|
+
load(localPropertiesFile.inputStream())
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
val appCheckDebugToken = localProperties.getProperty("APP_CHECK_DEBUG_TOKEN")
|
|
229
|
+
?: System.getenv("APP_CHECK_DEBUG_TOKEN") ?: ""
|
|
230
|
+
|
|
231
|
+
android {
|
|
232
|
+
defaultConfig {
|
|
233
|
+
// For normal emulator runs (injects into AndroidManifest)
|
|
234
|
+
manifestPlaceholders["firebaseAppCheckDebugSecret"] = appCheckDebugToken
|
|
235
|
+
|
|
236
|
+
// For instrumentation tests
|
|
237
|
+
if (appCheckDebugToken.isNotEmpty()) {
|
|
238
|
+
testInstrumentationRunnerArguments["firebaseAppCheckDebugSecret"] = appCheckDebugToken
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
```
|
|
@@ -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,7 +3,9 @@ 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
|
|
8
|
+
disable-model-invocation: true
|
|
7
9
|
---
|
|
8
10
|
|
|
9
11
|
# App Hosting Basics
|
|
@@ -39,7 +41,7 @@ to upgrade their plan.
|
|
|
39
41
|
This is the recommended flow for most users.
|
|
40
42
|
|
|
41
43
|
1. Configure `firebase.json` with an `apphosting` block.
|
|
42
|
-
|
|
44
|
+
|
|
43
45
|
```json
|
|
44
46
|
{
|
|
45
47
|
"apphosting": {
|
|
@@ -55,12 +57,15 @@ This is the recommended flow for most users.
|
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
```
|
|
60
|
+
|
|
58
61
|
1. Create or edit `apphosting.yaml`- see
|
|
59
62
|
[Configuration](references/configuration.md) for more information on how to
|
|
60
63
|
do so.
|
|
64
|
+
|
|
61
65
|
1. If the app needs safe access to sensitive keys, use
|
|
62
66
|
`npx -y firebase-tools@latest apphosting:secrets` commands to set and grant
|
|
63
67
|
access to secrets.
|
|
68
|
+
|
|
64
69
|
1. Run `npx -y firebase-tools@latest deploy` when you are ready to deploy.
|
|
65
70
|
|
|
66
71
|
### Automated deployment via GitHub (CI/CD)
|
|
@@ -3,7 +3,9 @@ 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
|
|
8
|
+
disable-model-invocation: true
|
|
7
9
|
---
|
|
8
10
|
|
|
9
11
|
## Prerequisites
|
|
@@ -74,7 +76,7 @@ Configure Firebase Authentication in `firebase.json` by adding an 'auth' block:
|
|
|
74
76
|
"supportEmail": "support@example.com",
|
|
75
77
|
"authorizedRedirectUris": [
|
|
76
78
|
"https://my-project-id.firebaseapp.com/__/auth/handler",
|
|
77
|
-
"http://localhost
|
|
79
|
+
"http://localhost"
|
|
78
80
|
]
|
|
79
81
|
}
|
|
80
82
|
}
|
|
@@ -84,11 +86,15 @@ Configure Firebase Authentication in `firebase.json` by adding an 'auth' block:
|
|
|
84
86
|
|
|
85
87
|
> [!NOTE] If the Google Sign-In popup opens and immediately closes with the
|
|
86
88
|
> error `[firebase_auth/unauthorized-domain]`, it means the domain is not
|
|
87
|
-
> authorized. For local development,
|
|
88
|
-
>
|
|
89
|
-
>
|
|
90
|
-
>
|
|
91
|
-
> `http://localhost
|
|
89
|
+
> authorized. For local development, add `http://localhost` to
|
|
90
|
+
> `authorizedRedirectUris` in `firebase.json` (or ensure `localhost` is included
|
|
91
|
+
> in the **Authorized Domains** list in the Firebase Console under
|
|
92
|
+
> Authentication > Settings > Authorized domains). **CRITICAL**: Do NOT include
|
|
93
|
+
> the port number in `authorizedRedirectUris` (e.g., use `http://localhost`, NOT
|
|
94
|
+
> `http://localhost:9090` or `http://localhost:4000`), and do NOT include the
|
|
95
|
+
> protocol or port number in the Console Authorized Domains list (use
|
|
96
|
+
> `localhost`). Including a port number in `authorizedRedirectUris` causes
|
|
97
|
+
> `firebase deploy --only auth` to fail with `INVALID_AUTHORIZED_DOMAIN`.
|
|
92
98
|
|
|
93
99
|
**CRITICAL**: After configuring `firebase.json`, you MUST deploy the auth
|
|
94
100
|
configuration to the Firebase backend for the changes to take effect. This is
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
# Firebase Authentication
|
|
1
|
+
# Firebase Authentication - Android Setup Guide (Kotlin)
|
|
2
2
|
|
|
3
|
-
This guide
|
|
4
|
-
using Kotlin DSL (`build.gradle.kts`) and
|
|
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.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
## Prerequisites
|
|
7
8
|
|
|
8
|
-
Before
|
|
9
|
-
|
|
9
|
+
IMPORTANT: Before specifically working with Firebase Authentication, make sure
|
|
10
|
+
to use the skill and reference `firebase_basics/references/android_setup` to
|
|
11
|
+
ensure the following is done.
|
|
12
|
+
|
|
13
|
+
- The Firebase CLI is available and authenticated.
|
|
14
|
+
- An Android project exists and is registered with a Firebase Project.
|
|
15
|
+
- The Android project has a Firebase config file (`google-services.json`) and
|
|
16
|
+
the Google services Gradle plugin (`google-services`).
|
|
17
|
+
|
|
18
|
+
______________________________________________________________________
|
|
19
|
+
|
|
20
|
+
## 1. Enable Authentication via CLI
|
|
21
|
+
|
|
22
|
+
Enable the Firebase Authentication service in the Firebase Project using the
|
|
23
|
+
Firebase CLI:
|
|
10
24
|
|
|
11
25
|
```bash
|
|
12
26
|
npx -y firebase-tools@latest init auth
|
|
@@ -14,27 +28,48 @@ npx -y firebase-tools@latest init auth
|
|
|
14
28
|
|
|
15
29
|
______________________________________________________________________
|
|
16
30
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
31
|
+
## 2. Add dependencies to Gradle build files
|
|
32
|
+
|
|
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
|
+
>
|
|
38
|
+
> ```bash
|
|
39
|
+
> # Find the latest Firebase Android BoM version
|
|
40
|
+
> curl -s https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-bom/maven-metadata.xml | grep -oE '<latest>[^<]+' | cut -d'>' -f2
|
|
41
|
+
>
|
|
42
|
+
> # Find the latest firebase-auth version
|
|
43
|
+
> curl -s https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-auth/maven-metadata.xml | grep -oE '<latest>[^<]+' | cut -d'>' -f2
|
|
44
|
+
> ```
|
|
45
|
+
>
|
|
46
|
+
> If the dependency is already declared, fetch the exact resolved version
|
|
47
|
+
> currently active in the workspace's build graph:
|
|
48
|
+
>
|
|
49
|
+
> ```bash
|
|
50
|
+
> ./gradlew -q :app:dependencyInsight --dependency firebase-auth --configuration releaseRuntimeClasspath
|
|
51
|
+
> ```
|
|
52
|
+
|
|
53
|
+
In the **module (app-level)** `build.gradle.kts` (usually
|
|
54
|
+
`<project>/<app-module>/build.gradle.kts`), add the dependency for Firebase
|
|
55
|
+
Authentication:
|
|
21
56
|
|
|
22
57
|
```kotlin
|
|
23
58
|
dependencies {
|
|
24
|
-
// [AGENT] Fetch the latest
|
|
59
|
+
// [AGENT] Fetch the latest resolved version using the Gradle command above
|
|
25
60
|
implementation(platform("com.google.firebase:firebase-bom:<latest_bom_version>"))
|
|
26
61
|
|
|
27
62
|
// Add the dependency for the Firebase Authentication library
|
|
28
|
-
// When using the BoM,
|
|
63
|
+
// When using the BoM, don't specify versions in Firebase library dependencies
|
|
29
64
|
implementation("com.google.firebase:firebase-auth")
|
|
30
65
|
}
|
|
31
66
|
```
|
|
32
67
|
|
|
33
68
|
______________________________________________________________________
|
|
34
69
|
|
|
35
|
-
|
|
70
|
+
## 3. Initialize FirebaseAuth
|
|
36
71
|
|
|
37
|
-
In
|
|
72
|
+
In the Activity or Fragment, initialize the `FirebaseAuth` instance:
|
|
38
73
|
|
|
39
74
|
```kotlin
|
|
40
75
|
import com.google.firebase.Firebase
|
|
@@ -48,6 +83,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
48
83
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
49
84
|
super.onCreate(savedInstanceState)
|
|
50
85
|
auth = Firebase.auth
|
|
86
|
+
|
|
51
87
|
setContent {
|
|
52
88
|
MaterialTheme {
|
|
53
89
|
Text("Auth initialized!")
|
|
@@ -57,7 +93,7 @@ class MainActivity : AppCompatActivity() {
|
|
|
57
93
|
}
|
|
58
94
|
```
|
|
59
95
|
|
|
60
|
-
|
|
96
|
+
### Jetpack Compose (Modern)
|
|
61
97
|
|
|
62
98
|
Initialize inside a `ComponentActivity` using `setContent`:
|
|
63
99
|
|
|
@@ -86,9 +122,9 @@ class MainActivity : ComponentActivity() {
|
|
|
86
122
|
|
|
87
123
|
______________________________________________________________________
|
|
88
124
|
|
|
89
|
-
|
|
125
|
+
## 4. Check current Auth state
|
|
90
126
|
|
|
91
|
-
|
|
127
|
+
Check if a user is already signed in when the activity starts:
|
|
92
128
|
|
|
93
129
|
```kotlin
|
|
94
130
|
public override fun onStart() {
|
|
@@ -105,7 +141,11 @@ public override fun onStart() {
|
|
|
105
141
|
|
|
106
142
|
______________________________________________________________________
|
|
107
143
|
|
|
108
|
-
|
|
144
|
+
## 5. Use sign-in providers in the app
|
|
145
|
+
|
|
146
|
+
### Email/Password
|
|
147
|
+
|
|
148
|
+
#### Sign up NEW users with Email/Password
|
|
109
149
|
|
|
110
150
|
Use `createUserWithEmailAndPassword` to register new users:
|
|
111
151
|
|
|
@@ -125,11 +165,9 @@ fun signUpUser(email: String, password: String) {
|
|
|
125
165
|
}
|
|
126
166
|
```
|
|
127
167
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
### 6. Sign In Existing Users (Email/Password)
|
|
168
|
+
#### Sign in EXISTING users with Email/Password
|
|
131
169
|
|
|
132
|
-
Use `signInWithEmailAndPassword` to
|
|
170
|
+
Use `signInWithEmailAndPassword` to sign in existing users:
|
|
133
171
|
|
|
134
172
|
```kotlin
|
|
135
173
|
fun signInUser(email: String, password: String) {
|
|
@@ -149,7 +187,7 @@ fun signInUser(email: String, password: String) {
|
|
|
149
187
|
|
|
150
188
|
______________________________________________________________________
|
|
151
189
|
|
|
152
|
-
|
|
190
|
+
## 6. Sign out users
|
|
153
191
|
|
|
154
192
|
To sign out a user, call `signOut()` on the `FirebaseAuth` instance:
|
|
155
193
|
|
|
@@ -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,7 +3,10 @@ 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
|
|
8
|
+
version: "1.0.0"
|
|
9
|
+
disable-model-invocation: true
|
|
7
10
|
---
|
|
8
11
|
|
|
9
12
|
# Prerequisites
|
|
@@ -57,11 +60,13 @@ Complete these setup steps before proceeding:
|
|
|
57
60
|
- **If using an existing Project ID:**
|
|
58
61
|
|
|
59
62
|
1. Check the current project by running `npx -y firebase-tools@latest use`.
|
|
63
|
+
|
|
60
64
|
1. If the command outputs `Active Project: <project-id>`, confirm with the
|
|
61
65
|
user if this is the intended project.
|
|
66
|
+
|
|
62
67
|
1. If not, or if no project is active, set the project provided by the
|
|
63
68
|
user:
|
|
64
|
-
|
|
69
|
+
|
|
65
70
|
```bash
|
|
66
71
|
npx -y firebase-tools@latest use <PROJECT_ID>
|
|
67
72
|
```
|
|
@@ -141,8 +146,9 @@ Adhere to these principles:
|
|
|
141
146
|
|
|
142
147
|
- **Login Issues:** If the browser fails to open during the login step, use
|
|
143
148
|
`npx -y firebase-tools@latest login --no-localhost` instead.
|
|
149
|
+
|
|
144
150
|
- **Genkit:** If using Genkit, install the skills:
|
|
145
|
-
|
|
151
|
+
|
|
146
152
|
```bash
|
|
147
153
|
npx skills add genkit-ai/skills
|
|
148
154
|
```
|