我正在使用React-Native和Firebase构建应用程序。无法访问Firebase数据库(尽管读取规则为true)
在另一个应用程序中工作的代码(从firebase中拉出)未能正常工作。所以,我修改了它要简单 - 一个时间数据呼叫,我得到以下错误:
Possible Unhandled Promise Rejection (id: 0):
Error: permission_denied at /userList: Client doesn't have permission to access the desired data.
即使我制定规则“真”(对所有人开放),我仍然得到同样的错误。在同一个应用程序的其他地方,我还有其他的读/写功能可以工作。
这里是我的现行规则和数据库结构:
{
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
},
"public": {
"$uid": {
".read": "auth != null",
".write": "auth != null"
}
},
"feedback": {
"$uid": {
".read": "auth != null",
".write": "auth != null"
}
},
"userList": {
"$uid": {
".read": "auth != null",
".write": "auth != null"
}
}
}
}
这里是我的行动的创建者,使召唤:
import firebase from 'firebase';
export const NAMES_FETCH = 'names_fetch'
export const namesFetch =() => {
return (dispatch) => {
firebase.database().ref(`/userList`).once('value').then(function(snapshot) {
var names = snapshot.val();
console.log('FIREBASE PRINT', names)
});
};
};
我已经竭尽所能,和我在我的智慧结束。谢谢!
忘了提,如果我改变裁判非常相同的代码工作“用户”而不是“用户列表” –