title: Firebase security rules doesn't allow when creating user
body: <p>I use Firebase <code>$authWithPassword</code> method for user login. I use the <code>$createUser</code> method to create registration for my users and on its success I update entry on my /users/ path to save the username, uid and some other details. Here is the code</p>
  
  <pre><code>var myDataRef = new Firebase(baseURL + 'datalog/');
  var refObj = $firebaseAuth(myDataRef);
  
  refObj.$createUser({
      email: $scope.emailId,
      password: $scope.password
  }).then(function(userData) {
      var UserUniqueUrl = new Firebase(baseURL + 'users/' + userData.uid + '/');
      UserUniqueUrl.set({
          'email': $scope.emailId,
          'username': $scope.username,
          'uid': userData.uid,
          'theme': 'default'
      }, function(error) {
          if (error) {
              console.log(error);
          } else {
              console.log('Successfully updated in user table');
          }
      });
  }).catch(function(error) {
      if (error.code == 'EMAIL_TAKEN') {
          $scope.regStatusError = 'Email already registered!';
      } else {
          $scope.regStatusError = 'Unable to register! Try again later.';
      }
  });
  </code></pre>
  
  <p>And here is my security rules</p>
  
  <pre><code>{
      "rules": {
          "users": {
              ".read": "auth != null",
              ".write": "auth != null"
          }
      }
  }
  </code></pre>
  
  <p>Now if I try to register it gives me permission denied error which I'm sure is because of the security rules <code>".read": "auth != null"</code> and <code>".write": "auth != null"</code>. If I change the rules to <code>".read": true</code> and <code>".write": true</code>, the registration will work but anyone will be able to see my user data including uid and email id which I don't want to happen. How do i change my rules to fit my need?</p>
  
  <p>This is how my user table will look like
  <a href="https://i.stack.imgur.com/SdMhw.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SdMhw.png" alt="enter image description here"></a>
  Any help is appreciated.
  Thanks.</p>