Попытка соединить мое приложение реакции с Firebase, получая ошибку.
Uncaught (in promise) Error: permission_denied at /tests: Client doesn't have permission to access the desired data.
Я прочитал все ответы, и все кажется правильным. Кто-нибудь, пожалуйста, посмотрите, что идет не так.
Когда я проверяю правило в симуляторе с
симулятор type = get
местоположение симулятора = database/tests
показывает вывод успешных результатов.
Могу ли я неправильно использовать ref
Приложение Inside React -
Пакет, который я использую - "firebase": "^5.4.2",
Код реакции
1.Config.js File
// Initialize Firebase
import firebase from 'firebase';
const config = {
apiKey: "xxxx",
authDomain: "xxxx",
databaseURL: "xxxx",
projectId: "xxx",
storageBucket: "xxx",
messagingSenderId: "xxx"
};
const fire = firebase.initializeApp(config)
export { fire }
2. В моем контейнере компонент
import { fire } from '../../Config/Config';
componentWillMount() {
let testRef = fire.database().ref().child('tests');
//also tried this
//let testRef = fire.database().ref('tests');
console.log('testRef', testRef)
testRef.once("value").then((f) => {
console.log(f);
});
}
3. Правила в моей учетной записи firebase
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
- Данные в тестах узле
![Image representing how node is present in my databse](https://i.stack.imgur.com/h7xfM.png)