Firebase Can't Push Data Given The Ruleset
I'm trying to create a password protected chat room and found this SO answer to user as an example: Firebase: approach to storing room passwords The problem is, given the ruleset i
Solution 1:
For this to work you have to write to the path(s) were your rules are.
To do that you will have to split up your push()
into two parts: generating the key and actually writing the data:
// Generate the key (this happens client side)var key = firebase.database().ref(`myApp/chatRooms`).push().key;
// Use the key to write your data
firebase.database().ref(`myApp/chatRooms`).child(key).child('chatInfo').set({admin: this.state.currentUser.uid, chatName: "foobar"});
firebase.database().ref(`myApp/chatRooms`).child(key).child('password').set("test");
Post a Comment for "Firebase Can't Push Data Given The Ruleset"