skip to Main Content

I have several errors in my project when an user logs out.

The errors are like this:

Notifying id token listeners about a sign-out event.  
D/FirebaseAuth( 8062): Notifying auth state listeners about a sign-out event. 

W/Firestore( 8062): (24.7.0) [Firestore]: 
Listen for Query(target=Query(users where 
uid==U1bS1arrd4PvLH4bmt8sIXg0aAH3 order by __name__);limitType=LIMIT_TO_FIRST) 
failed: Status{code=PERMISSION_DENIED, description=Missing or 
insufficient permissions., cause=null}

I have a bloc/cubit architecture.

2

Answers


  1. Go in Database -> Rules ->

    For development:

    Change allow read, write: if false; to true;

    For production:

    If authenticated from firebase: Change allow read, write: if false; to
    request.auth != null;

    You can also review it from the Firebase documentation. https://firebase.google.com/docs/firestore/security/get-started

    final _firebaseAuth = FirebaseAuth.instance;
    Future<User?>SignOut()async{
        await _firebaseAuth.signOut();
        await GoogleSignIn().signOut(); // if you use Sign-in with Google
      }
    

    If you need a Sign Out code, you can also use this. I hope I have helped. Enjoy your work.

    Login or Signup to reply.
  2. From the error message it seems that you have a realtime listener to some data in Firestore, and you have set up your security rules to only allow reading that data when/while the user of the app is signed in to Firebase Authentication.

    When you sign out, the user no longer meets the requirement of your security rules, and the listener gets cancelled because of that.

    If you want to prevent getting the error message, you will have to remove the listener(s) before signing out the user.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search