When developing an application on React, such a problem appeared. There is a Firebase remote database from which I need to upload data. There is a similar application on Android that works correctly without errors, and the react-application cannot connect to the firebase. I will say right away that my access rights to the database are configured as follows:
{ "rules": { ".read": "auth != null", ".write": "auth != null" } } When I set the property values to true, I get access to the database, but I don’t want to do that, since I openly access my database. But the connection code to the firebase from the js application, here I insert the config file that firebase itself gave me:
import firebase from 'firebase'; const config = { apiKey: "***", authDomain: "***", databaseURL: "***", projectId: "***", storageBucket: "***", messagingSenderId: "***" }; firebase.initializeApp(config); export const database = firebase.database(); export const auth = firebase.auth(); When firebase.auth() null When I try to output data from the database, I get the following message:
permission_denied at / restaurants: Client
How can this problem be solved?