Firebase用户为已注册的用户返回空元数据 [英] Firebase user returns null metadata for already signed up users
问题描述
我一直在使用Firebase对应用程序中的用户进行身份验证.注册后用户返回应用程序时,FirebaseAuth.getInstance().getCurrentUser().getMetadata()
返回null
.当用户首次注册时,它可以完美运行,但返回null
即可返回老用户.
I have been using Firebase for authentication of users in the app. FirebaseAuth.getInstance().getCurrentUser().getMetadata()
returns null
when user comes back to the app after the sign up. It works perfectly when user signs up for the first time, but returns null
for returning users.
推荐答案
马尔科姆.
感谢您指出这一点.目前,这是Android SDK持久性存在的错误.我们将尽快修复此问题-请密切关注即将发布的发行说明,以了解何时可以解决该问题.
Thanks for pointing this out. This is presently a bug in the persistence done by the Android SDK. We'll get on fixing this ASAP - keep an eye on upcoming release notes to know when it's resolved.
In the meantime, the workaround you can use is to write to your app's SharedPreferences to store those attributes at sign up time, and read from those Prefs when you need them elsewhere in your app. Hope this helps!
这篇关于Firebase用户为已注册的用户返回空元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!