Permission error when accessing a cached firestore collection after logout/login
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- firebase, react, typescript
調査の方向性
useFirestoreCollectionData と同じコレクションを使って sign-out/sign-in のシーケンスを再現し、その後、グローバルなコレクションキャッシュが認証の変更をどのように処理するかを調査します。キャッシュされた読み取りと、ログイン後に idField を変更する回避策を比較します。再認証後も、権限エラーなしで同じコレクションを読み取れるようになれば完了です。できれば、回帰テストまたは再現手順のドキュメントも追加します。
索引モデルが 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時間
- マージ済み PR(30日)
- 10
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
FirebaseExtended/reactfire のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 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 1週間以上 初心者へのやさしさ 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