问题
I'm using firebase database using firebaseUser authorisation. I successfully logout user from app, but when I logout user the app is crashed due to firebase database reference. I got logcat message showing that
This client does not have permission to perform this operation.
How can I logout user from firebase database?
回答1:
You don't logout from the "database" as such, but logout from Firebase with FirebaseAuth.getInstance().signOut()
.
After that, the user can't access parts of the database that requires user credentials, and I guess it's the reason why your app crashed. So when you make database calls, you need to check if the user has correct credential.
回答2:
I added ValueEventListener to firebase database reference, when i'm trying to logout the user ValueEventListener is still running in background that's why my app is crashing.
I removed ValueEventListener from firebase database reference and my problem is solved.
来源:https://stackoverflow.com/questions/45183677/how-to-logout-user-from-firebase-database