Ankush
Ankush

Reputation: 77

getting error in cloud firestore permission

getting error in cloud firestore my image is not storing in firebase the screen is not displaying

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: [cloud_firestore/permission-denied] The caller does not have permission to execute the specified operation. #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7) #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:315:18) #2 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:518:43) #3 MethodChannelDocumentReference.get (package:cloud_firestore_platform_interface/src/method_channel/method_channel_document_reference.dart:69:42) #4 _JsonDocumentReference.get (package:cloud_firestore/src/document_reference.dart:146:7) #5 _HomePageState.getArrLength (package:marcjrfoundation/pages/home/home.dart:341:33) #6 _HomePageState.notifyUser (package:marcjrfoundation/pages/home/home.dart:111:<…>

security rules

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth != null;
    }
  }
}

Upvotes: 1

Views: 547

Answers (2)

hazem
hazem

Reputation: 76

I had this issue before

On September 19, a major change to Cloud Storage for Firebase was finalized where each Firebase project will now have its own dedicated storage service account, resulting in improved security.

check this link for more info

and I called this API Solved my problem I tried this

POST https://firebasestorage.googleapis.com/v1beta/{bucket=projects/*/buckets/*}:addFirebase

From here it took a minutes and it work the firebase storage Roles finally applied ,

Upvotes: 0

Atiq Rehman
Atiq Rehman

Reputation: 32

change your rules for cloud firestore as well firebase Storage like this.

//firestore

 allow read, write: if true;

//firebase Storage

allow read, write: if true;

in my case, I changed both rules now working fine everything. try it maybe its help you

Upvotes: 0

Related Questions