Firebase安全-Apikey

Firebase安全-Apikey,firebase,google-cloud-firestore,firebase-security,Firebase,Google Cloud Firestore,Firebase Security,是否可以在firestore中将所需的标题设置为安全规则? 因此,当我使用RESTAPI时,应该有一个x-apikey=“1234” 如果可能怎么办 rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write; } } } 在Firestore安全规则中无法要求特定

是否可以在firestore中将所需的标题设置为安全规则?

因此,当我使用RESTAPI时,应该有一个
x-apikey=“1234”

如果可能怎么办

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write;
    }
  }
}

在Firestore安全规则中无法要求特定的头值。安全规则中唯一可用的信息是经过身份验证的用户的令牌、正在访问的路径,当然还有正在写入的信息(用于写入操作)

我有时会将“API键”作为路径的一部分,例如将其用作文档ID。这样,用户必须指定正确的文档ID/API键才能读取文档

如果要将特定于用户的值传递到安全规则中,您可能还需要查看