Permission error when accessing a cached firestore collection after logout/login
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- firebase, react, typescript
研究方向
使用 useFirestoreCollectionData 和同一個 collection 重現 sign-out/sign-in 流程,然後檢查全域 collection cache 如何處理驗證狀態的變更。將快取讀取與登入後變更 idField 的 workaround 進行比較。重新驗證後仍能讀取同一個 collection 且不出現權限錯誤,即可視為完成;最好提供 regression test 或記錄完整的 reproduction。
由索引模型根據 Issue 內容生成。
描述
Version info
React: 17.0.2
Firebase: 9.4.0
ReactFire: 4.2.0
Other (e.g. Node, browser, operating system) (if applicable): Chrome, Windows 10
Test case
Test cases seem challenging to produce since a firebase instance is involved.
Steps to reproduce
- Sign In (I used
GoogleAuthProvider), or be already signed-in. - Read from a collection.
- Sign Out
- Sign In
- Read from the same collection.
Expected behavior
The same data is read.
Actual behavior
Uncaught FirebaseError: Missing or insufficient permissions. is thrown.
This seems to be caused by the global cache of collections. The problem can be mitigated by:
- Refreshing the page after sign out
- Changing the
idFieldpassed touseFirestoreCollectionData. Any easy way to test this is to useid-${auth.stsTokenManager.expirationTime}as youridField, sinceexpirationTimechanges on every Sign Out/In cycle.
Note that waiting more than 30 seconds does not fix the problem. So, the cache resetting of the collection is insufficient to resolve the issue. I suspect that the collection is associated with the stale auth token which has been disabled due to logout.
A possible resolution might be to purge the cache on sign out.
- 主要語言
- TypeScript
- 星號
- 3.6k
- 分支
- 403
- 平均合併
- 5 天 1 小時
- 30 天內合併 PR
- 10
環境準備
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
FirebaseExtended/reactfire 的其他 Issue
-
難度 5/5 一週以上 新手友好度 38/100
FirebaseExtended/reactfire#801 ·
-
v5
難度 4/5 3-5 天 新手友好度 48/100
FirebaseExtended/reactfire#793 ·
-
v5
難度 4/5 3-5 天 新手友好度 35/100
FirebaseExtended/reactfire#790 · 2 則留言 ·
-
v5
難度 4/5 3-5 天 新手友好度 55/100
FirebaseExtended/reactfire#789 ·
-
難度 5/5 一週以上 新手友好度 35/100
FirebaseExtended/reactfire#788 ·
查看 FirebaseExtended/reactfire 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
rohitg00/agentmemory#1428 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 86/100
boxlite-ai/boxlite#1729 ·
維護者通常 1 天內回覆
-
detectors enhancement good first issue
難度 2/5 1-3 小時 新手友好度 86/100
SM260845/readme-gen#1 ·
-
難度 2/5 1-3 小時 新手友好度 88/100
angular/angularfire#3774 ·
維護者通常 2 天內回覆