0
在我火力的數據庫,我已經設置了以下規則:權限被拒絕值設置爲火力地堡數據庫
{
"rules": {
"Users": {
"$uid": {
".write": "$uid === auth.uid",
".read": "$uid === auth.uid"
}
}
}
}
我開發iOS應用與火力地堡。我使用Facebook的身份驗證登錄到我的應用程序,我想用戶ID添加到數據庫時,登錄成功,這是我的代碼:
let ref = Database.database().reference()
...
// I got uid
ref.child("Users").setValue(uid)
但我得到的錯誤:
setValue: or removeValue: at /users failed: permission_denied
爲什麼?
謝謝,但我怎麼能添加uid到「用戶」只爲Facebook認證的用戶?正如我在我的問題中提到的,'uid'是成功登錄的用戶(Facebook登錄) –
我共享的代碼片段解決了您在問題中出現的錯誤消息。如果您想額外檢測用戶是否使用Facebook登錄,請參閱https://stackoverflow.com/questions/39056853/how-to-detect-if-a-user-has-signed-in-to-my-應用 - 使用 - 火力 - 與Facebook的-EM –