Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Permission error when accessing a cached firestore collection after logout/login

Aberta
#485 4 comentários 10 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
firebase, react, typescript

Direção de pesquisa

Reproduza a sequência de sign-out/sign-in com useFirestoreCollectionData e a mesma collection e, em seguida, inspecione como o cache global de collections lida com alterações na autenticação. Compare a leitura em cache com o workaround de alterar idField após o login. O trabalho estará concluído quando a mesma collection puder ser lida após a reautenticação sem um erro de permissão, idealmente com um teste de regressão ou uma reprodução documentada.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

v5
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
  1. Sign In (I used GoogleAuthProvider), or be already signed-in.
  2. Read from a collection.
  3. Sign Out
  4. Sign In
  5. 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 idField passed to useFirestoreCollectionData. Any easy way to test this is to use id-${auth.stsTokenManager.expirationTime} as your idField, since expirationTime changes 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.

Linguagem predominante
TypeScript
Estrelas
3.6k
Forks
403
Merge médio
5d 1h
PRs com merge (30d)
10

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de FirebaseExtended/reactfire

Todas as issues de FirebaseExtended/reactfire

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.