我正在使用 Firebase UI Auth为了在我的应用程序中处理电子邮件登录,我启用了磁盘持久性,以便可以离线访问数据。但是在应用程序中登录一个小时后,我在 logcat 中收到此警告。
W/PersistentConnection: pc_0 - Auth token revoked: expired_token (Auth token is expired.)
W/PersistentConnection: pc_0 - Authentication failed: invalid_token (Invalid claim 'kid' in auth header.)
W/PersistentConnection: pc_0 - Authentication failed: invalid_token (Invalid claim 'kid' in auth header.)
... repeatedly
... and sometimes
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
当我收到此消息时,除非我注销/清除数据然后再次登录,否则应用无法执行任何 firebase 保存/检索新的未缓存数据操作。然后登录后大约一个小时后问题再次发生。我已经关注了这个token refresh troubleshooting guide (将我的调试和生产 key SHA1 添加到 Firebase 和 Google API 控制台)但它没有解决这个问题。我在我的项目中使用了来自 Firebase 控制台的最新 google-services.json
。
我也已经在使用最新的 Firebase SDK 和 Play 服务库
compile 'com.google.android.gms:play-services-auth:9.2.1'
compile 'com.google.firebase:firebase-core:9.2.1'
compile 'com.google.firebase:firebase-database:9.2.1'
compile 'com.google.firebase:firebase-auth:9.2.1'
compile 'com.firebaseui:firebase-ui-auth:0.4.3'
我在 Application
类中启用了持久化。
public class Application extends android.app.Application {
@Override
public void onCreate() {
super.onCreate();
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
}
}
有什么想法吗?如果您需要更多说明或者我没有提供足够的信息,请随时发表评论。 谢谢
最佳答案
Firebase 服务器无法识别 child 22fb7e6f95c657f4407e04e97c984bb6dbbcfeb3。如果帐户电子邮件不同,getToken() 肯定会返回不同的 token 。请向 Firebase 提交票证,包括来自您的两个应用的整个 token 负载。
关于android - 1 小时后身份验证 token 无效 - Firebase 中的磁盘持久性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38544874/