How to logout user from firebase database?

六眼飞鱼酱① 提交于 2020-05-16 03:32:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!