[英]FirebaseNetworkException cannot be cast to com.google.firebase.auth.FirebaseAuthException
[英]signInAnonymously:FAILURE com.google.firebase.auth.FirebaseAuthException: despite Anonymous Sign in enabled
尽管我在我的 Firebase 项目中启用了匿名登录,但我的移动 (Android) 应用程序无法进行身份验证,并且出现此错误(在模拟器和物理设备上也是如此)。
signInAnonymously:FAILURE com.google.firebase.auth.FirebaseAuthException:此操作仅限于管理员。
我的 Firebase 配置:
我的代码:
mAuth = FirebaseAuth.getInstance();
...
// Sign in anonymously. Authentication is required to read or write from Firebase Storage.
mAuth
.signInAnonymously()
.addOnSuccessListener(
mActivity,
authResult -> {
Log.d(TAG, "signInAnonymously:SUCCESS");
try {
upload();
} catch (Exception e) {
Log.e(TAG, "upload:FAILURE", e);
}
})
.addOnFailureListener(
mActivity,
exception -> {
Log.e(TAG, "signInAnonymously:FAILURE", exception);
});
}
依赖项:
implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'com.google.firebase:firebase-storage:20.0.0'
implementation "com.google.firebase:firebase-core:18.0.2"
有没有人有同样的问题?
好吧,最后,我将软件包更新为:
+ implementation platform('com.google.firebase:firebase-bom:29.0.2')
+ implementation 'com.google.firebase:firebase-auth'
+ implementation 'com.google.firebase:firebase-storage'
... implementation "com.google.firebase:firebase-core:18.0.2" //not updated
使 Firebase 存储规则如下所示(免责声明:对于我的调试版本,我想生产会更严格):
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write;
}
}
}
它开始起作用了。 但老实说不知道为什么¯\ (ツ) /¯。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.