title: Send data to Firebase anonymously
body: <p>I would like anonymous users to be able to send data to Firebase but not to delete or overwrite it.</p>
  
  <p>This is what I have been using lately:</p>
  
  <p>My database rules:</p>
  
  <pre><code>{
    "rules": {
      ".read": false,
      ".write": true
    }
  }
  </code></pre>
  
  <p>My javascript snippet:</p>
  
  <pre><code>firebase.initializeApp({
      apiKey: "asdasd",
      databaseURL: "asdasd.firebaseio.com/"
  });
  
  var id = Math.random().toString(36).substr(2, 9);
  var userData = 'hello';
  var sendData = firebase.database().ref("data/" + id + "/").update({userData});
  
  sendData.then(function() { console.log("data sent!") })
  </code></pre>
  
  <p>The obvious problem is that I am exposing my apiKey in the script and anyone could overwrite or delete the data. Is there any practical solution?</p>