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 小时 新手友好度 84/100
bcgov/bc-wallet-mobile#4761 · 1 条评论 ·
-
external-issue to-triage
难度 2/5 1-3 小时 新手友好度 88/100
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
refactor
难度 2/5 1-3 小时 新手友好度 84/100