[firebase_ai] Live sessions on web don't send the App Check token
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- api, authentication
Línea de trabajo
Start with lib/src/live_session.dart and live_model.dart, then check how web WebSocket connections can pass Firebase App Check and Auth tokens and whether the backend accepts them in the query or setup message. Reproduce the reported Chrome connection with App Check enforced; done means Live sessions send the required tokens on web and the server no longer closes them with code 1008.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug
On web, a LiveGenerativeModel session doesn't send the App Check token, so when App Check is enforced for Firebase AI Logic the server closes every Live session right after it connects:
WebSocket Closed, closeCode: 1008, closeReason: Firebase App Check token is invalid.
Non-Live requests in the same app pass App Check with the same token.
Cause
LiveSession._defaultConnector in lib/src/live_session.dart drops the headers on web:
static WebSocketChannel _defaultConnector(
Uri uri, Map<String, String> headers) =>
kIsWeb
? WebSocketChannel.connect(uri)
: IOWebSocketChannel.connect(uri, headers: headers);
live_model.dart builds those headers with BaseModel.firebaseTokens(...), so the X-Firebase-AppCheck header (and the Auth token) only reach the server on native platforms. On web the token is in neither the URL (only ?key=) nor the setup message. Browsers can't set headers on a WebSocket, so the token needs to travel another way, for example as a query parameter or in the setup message, if the backend accepts one.
Same code in firebase_ai 3.15.0, 4.0.0, 5.0.0 and 5.1.0.
Repro
- Enforce App Check for Firebase AI Logic and register a web debug token.
- On Chrome, connect a Live session, for example
FirebaseAI.googleAI().liveGenerativeModel(model: 'gemini-3.8-live')andconnect(). - The server closes the socket with 1008 "Firebase App Check token is invalid".
Seen with the Gemini Developer API and with Agent Platform (us-central1). Found through the Genkit Firebase AI plugin: genkit-ai/genkit-dart#730.
Versions
firebase_ai 5.1.0, Flutter 3.47.9, Chrome.
- Lenguaje dominante
- Dart
- Estrellas
- 9.3k
- Forks
- 4.1k
- Merge medio
- 2 d 10 h
- PR fusionados (30 d)
- 78
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de firebase/flutterfire
-
🚀 [firebase_core] Bump Firebase C++ SDK (14.1.0 → 14.2.0)Posiblemente ocupada @SelaseKay la tomó hoy. AbiertoNeeds Attention type: enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
firebase/flutterfire#18977 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[firebase_core_web]: Firebase.initializeApp never completes when a Firebase JS SDK script fails to loadPosiblemente ocupada @LasseLegarth la tomó hace 5 días. AbiertoNeeds Attention platform: web plugin: core reproduced type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
firebase/flutterfire#18964 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Needs Attention platform: android plugin: crashlytics type: enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
firebase/flutterfire#18951 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
[cloud_firestore][Windows] Invalid field names (empty or `__x__`) close the app instead of throwing a FirebaseExceptionPosiblemente ocupada @SelaseKay la tomó hace 5 días. AbiertoNeeds Attention platform: windows plugin: cloud_firestore reproduced type: bug type: crash
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
firebase/flutterfire#18928 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Needs Attention plugin: ai type: enhancement
Dificultad 3/5 1-2 días Aptitud para principiantes 67/100
firebase/flutterfire#18917 ·
Los mantenedores suelen responder en 1 día
Todos los issues de firebase/flutterfire
Issues similares
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
[BUG] 172.2* 排除域名包含公网IPAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
-
agent: is checked on a wrapper holding several checkables answers from the first one in tree orderAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
AlphaWaveSystems/flutter-probe#865 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
ubuntu/app-center#2306 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
spotiflacapp/SpotiFLAC-Mobile#923 ·