且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android FirebaseAuth.getCurrentUser()永不为空

更新时间:2023-12-02 13:03:28

Firebase身份验证将在用户登录时为用户缓存身份验证令牌.这避免了必须对用户与由其提供的其他服务进行的每一次微小交互进行身份验证的情况.火力基地.该令牌会定期自动刷新,但在此之前,SDK会假定该令牌代表用户.您会发现令牌会在一段时间后过期,或者您可以通过卸载并重新安装该应用程序或清除其数据来强制该问题.

Firebase Authentication will cache an authentication token for the user when they're signed in. This prevents having to authenticate every little interaction the user makes with other services provided by Firebase. This token gets automatically refreshed periodically, but until then, the SDK assumes that the token represents the user. You'll find that the token will expire after some time, or you can force the issue by uninstalling and reinstalling the app, or clearing its data.

身份验证有效,无论实时数据库的内容如何.它们彼此独立,除非安全规则将访问权限限制为当前经过身份验证的用户.

Authentication works regardless of the contents of your Realtime Database. They are independent from each other, except where security rules limit access to the currently authenticated user.