Missing or insufficient permissions when writing to Firestore using field in access rules

后端 未结 3 1741
北海茫月
北海茫月 2021-02-03 19:55

I am getting an error when attempting to write to Firestore.

I am attempting to use a field containing the user uid for my security rule.

service cloud.f         


        
3条回答
  •  伪装坚强ぢ
    2021-02-03 20:29

    resource.data refers to the data already stored, so your rule allowed users to only update data that already includes their user ID.

    What you probably want to check is request.resource.data which is the new data coming in.

    There's a rather extensive document about those fields and other security rules here: https://firebase.google.com/docs/firestore/security/rules-conditions

提交回复
热议问题