[英]Firebase - How to set security rules so that only logged in users can read and write?
[英]How can I set up my firebase rules so only content-owners have read and write to their data?
我已經檢查了文檔,但我不確定如何將該規則應用於我的特定數據結構,請檢查我的數據是如何組織的,並向我提供規則,因為它應該是 go。
我正在使用實時數據庫,在我的應用程序代碼中,我根據用戶 ID 編寫和讀取,但 firebase 一直告訴我應該更改我的規則。
要應用文檔中關於僅內容所有者訪問您的結構的規則,需要:
{
"rules": {
"Expenses": {
"$uid": {
// Allow only authenticated content owners access to their data
".read": "auth != null && auth.uid == $uid"
".write": "auth != null && auth.uid == $uid"
}
},
"Users": {
"$uid": {
// Allow only authenticated content owners access to their data
".read": "auth != null && auth.uid == $uid"
".write": "auth != null && auth.uid == $uid"
}
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.