title: How to use firebase with read and write rules as false
body: <p>I am working on a project and I followed few tutorials in order to learn and build the app. But all of them, they change the Firebase read and write rules to true which is not safe. for example they change </p>
  
  <pre><code>{
    "rules": {
      ".read": false,
      ".write": false
    }
  }
  </code></pre>
  
  <p>to </p>
  
  <pre><code>{
    "rules": {
      ".read": true,
      ".write": true
    }
  }
  </code></pre>
  
  <p>This gives access to anyone to read and write the server data which is not safe in any way. And hence I turned this to false and now I am unable to register the user to Firebase it is giving an error saying 'Permission Denied. So what would I have to do in order to get the permission now. </p>
  
  <p>Previously I was using this code to register the user to Firebase which is not working now.</p>
  
  <pre><code>mFirebaseAuth.createUserWithEmailAndPassword(editEmail.getText().toString(), editPass.getText().toString()).addOnSuccessListener(new OnSuccessListener&lt;AuthResult&gt;() {
                      @Override
                      public void onSuccess(AuthResult authResult) {
  
                          //Saving User to Database
  
                          User user = new User();
                          user.setEmail(editEmail.getText().toString());
                          user.setName(editName.getText().toString());
                          user.setPassword(editPass.getText().toString());
                          user.setPhone(editPhone.getText().toString());
  
  
                          users.child(FirebaseAuth.getInstance().getCurrentUser().getUid()).setValue(user).addOnSuccessListener(new OnSuccessListener&lt;Void&gt;() {
                              @Override
                              public void onSuccess(Void aVoid) {
                                  waitingdialog.dismiss();
                                  Snackbar.make(rootLayout, "Registration Successful", Snackbar.LENGTH_SHORT).show();
                                  return;
                              }
                          }).addOnFailureListener(new OnFailureListener() {
                              @Override
                              public void onFailure(@NonNull Exception e) {
                                  waitingdialog.dismiss();
                                  Snackbar.make(rootLayout, "Registration Failed" + e.getMessage(), Snackbar.LENGTH_LONG).show();
                                  return;
                              }
                          });
                      }
                  });
  </code></pre>