[firebase_auth_web]: Make the Auth emulator persistence from #18926 configurable instead of hard-gated on kDebugMode
I maintainer di solito rispondono entro 4 giorni
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 62/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- authentication, web-dev
Direzione di ricerca
Start from the two kDebugMode gates in packages/firebase_auth/firebase_auth_web/lib/firebase_auth_web.dart (restore on plugin init ~L60-75, remember-after-connect ~L565-600) and read the #18926 diff; the isAuthEmulatorDebugHost loopback check stays as is. Because the origin is reapplied inside Firebase.initializeApp, the flag must be readable before init: decide between a static on FirebaseAuth in the firebase_auth package (threaded through the platform interface) or a bool.fromEnvironment define, then have the web implementation read it. Done means the default still equals kDebugMode, profile builds can opt in, and existing web auth tests plus a new gate test pass.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Which plugins/Platforms are affected?
Auth on Web
TL;DR
The fix from #18926 that keeps the Auth emulator across restarts is hard-gated on kDebugMode, so profile builds can't use it; please make that gate a setting, with a default of kDebugMode to keep existing behavior.
Description
#18926 (fixing #18888) keeps the Auth emulator origin across reloads and browser restarts, so a persisted user is never restored against production before useAuthEmulator runs. All of it is hard-gated on kDebugMode:
- restore on plugin init: https://github.com/firebase/flutterfire/blob/6a80b1b5eea1ea86ba8c7e7bf2a8525cabb77126/packages/firebase_auth/firebase_auth_web/lib/firebase_auth_web.dart#L60-L75
- remember after connect: https://github.com/firebase/flutterfire/blob/6a80b1b5eea1ea86ba8c7e7bf2a8525cabb77126/packages/firebase_auth/firebase_auth_web/lib/firebase_auth_web.dart#L565-L600
Request: replace those kDebugMode checks with a single setting whose default is kDebugMode, so nothing changes unless an app opts in. Because the origin is reapplied inside Firebase.initializeApp, the setting has to be readable before init, e.g. either:
// set before Firebase.initializeApp
FirebaseAuth.persistWebEmulatorOrigin = true; // default: kDebugMode
or a compile-time define:
const persist = bool.fromEnvironment(
'FIREBASE_AUTH_PERSIST_EMULATOR',
defaultValue: kDebugMode,
);
The existing loopback-host check (isAuthEmulatorDebugHost) would stay as it is.
Why is this important?
Profile builds are a normal way to test against the emulators. Debug can be too slow for canvas-heavy apps. In profile mode today:
- The persisted (anonymous) emulator user is restored from IndexedDB on startup.
- If its ID token is older than an hour, it is refreshed against
securetoken.googleapis.com, which is production. With a referrer-restricted key, that fails withauth/requests-from-referer-http://localhost:<port>/-are-blocked. - The later
useAuthEmulatorcall fails withemulator-config-failed, silently outside debug, so Auth stays on production for the whole session, and Firestore on its emulator reports "client is offline".
The only way out is clearing site storage, which deletes the anonymous user and its emulator data every time.
Additional context and comments
firebase_core 5.2.0, firebase_auth 7.1.0, firebase_auth_web 6.4.0.
Related: #11233, #11534, #18689, #18888, #18926.
- Lingua principale
- Dart
- Stelle
- 9.3k
- Fork
- 4.1k
- Merge medio
- 4g 17h
- PR unite (30g)
- 49
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di firebase/flutterfire
-
[cloud_functions]: Apple platforms ignore custom domains passed as regionForse già presa @ragavendranbala-TSL l’ha presa oggi. ApertaNeeds Attention platform: ios platform: macos plugin: functions type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
firebase/flutterfire#19015 · 2 commenti ·
I maintainer di solito rispondono entro 4 giorni
-
Needs Attention platform: android plugin: messaging type: bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
firebase/flutterfire#19017 ·
I maintainer di solito rispondono entro 4 giorni
-
Needs Attention platform: web plugin: crashlytics type: enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 34/100
firebase/flutterfire#19014 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni
-
[firebase_messaging]: Android getToken() errors lose their cause since firebase-messaging 25.1.0 ("FCM Registration failed!")Forse già presa @SelaseKay l’ha presa 3 giorni fa. ApertaNeeds Attention platform: android plugin: messaging reproduced type: bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
firebase/flutterfire#18997 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni
-
[firebase_storage]: Windows: getData() crashes with access violation (use-after-free of StorageReference in ReferenceGetData)Forse già presa @SelaseKay l’ha presa 3 giorni fa. Apertablocked: customer-response platform: windows plugin: storage type: bug type: crash
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
firebase/flutterfire#18994 · 2 commenti ·
I maintainer di solito rispondono entro 4 giorni
Tutte le issue di firebase/flutterfire
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
hajisensai/Fushi#4543 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[video_player] _updatePosition sets isCompleted=true after 500ms when duration is Duration.zeroAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
dart-lang/dart_style#1928 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
chriskelly/wish-together#212 ·
I maintainer di solito rispondono entro 1 giorno