我已經檢查了檔案,但我不確定如何將該規則應用于我的特定資料結構,請檢查我的資料是如何組織的,并向我提供應有的規則。
我正在使用實時資料庫,在我的應用程式代碼中,我根據用戶 ID 撰寫和讀取,但 firebase 一直告訴我應該更改我的規則。

uj5u.com熱心網友回復:
要在content-owner 檔案中應用規則,僅訪問您的結構需要:
{
"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"
}
}
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/449591.html
標籤:安卓 火力基地 firebase-实时数据库 firebase-安全
