Firebase的新蜂,我正在尝试Firebase身份验证,并尝试检查用户是否已登录.代码:
A new bee to Firebase, I am trying out the Firebase Authentication and trying to check if user is logged-in. code:
null != mAuth.getCurrentUser();尽管我未登录,但我启用了匿名登录,但这会返回 true ,我认为这可能是问题所在,但是当我检查时 mAuth.getCurrentUser().isAnonymous()我正在获取 false .
And this returns true though I am not logged in but I have enabled annonymous login and I thought that could be the issue but when I check mAuth.getCurrentUser().isAnonymous() I am getting false.
在IDE上检查 mAuth.getCurrentUser()会显示以下内容:
Inspecting mAuth.getCurrentUser() on the IDE shows this:
这里有什么方向吗?
推荐答案我有一个类似的问题,那就是退出Firebase是不够的-它会再次自动登录.
I've had a similar issue and it was that signing out of Firebase is not enough - it will sign in automatically again.
还必须使用GoogleSignInApi退出:
It's necessary also to sign out using the GoogleSignInApi:
firebaseAuth.signOut(); Auth.GoogleSignInApi.signOut(apiClient);更多推荐
Firebase:如何检查用户是否已登录?
发布评论