繁体   English   中英

获取 downloadUrl [Flutter] 时的 Firebase 存储异常

[英]Firebase Storage Exception when fetching downloadUrl [Flutter]

尝试使用 FireBase 云存储获取视频时 downloadUrl

final storage = FirebaseStorage.instance;
downloadUrl() async {
  final downloadUrl =
      await storage.ref("User_uploadVideo/videoplayback.mp4").getDownloadURL();
  return downloadUrl;
}

抛出一个异常,说Exception: [firebase_storage/unauthenticated] User is unauthenticated. Authenticate and try again. Exception: [firebase_storage/unauthenticated] User is unauthenticated. Authenticate and try again.

即使我已经向公众开放了安全规则以进行开发。

service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write;
    }
  }
}

尝试这个:

service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write: if true;
    }
  }
}

主要.dart

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  ); 
...

此外,请确保禁用 AppCheck。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM