出现此错误
error getting token java.util.concurrent.ExecutionException: com.google.firebase.internal.api.FirebaseNoSignedInUserException: Please sign in before trying to get a token.
我已将 Firebase 存储规则更改为
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write;
}
}
}
这是我的代码
getImageFirebase(String locations, String imageName) {
String check = "";
check =
storageRef.child(locations).child(imageName).getDownloadURL().toString();
return check;
}
为什么我更改规则后总是需要令牌?
你必须像这样更新你的规则:
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
} }