Firebase: Permission denied after authWithPassword; probably because Firebase rules
<p>Here's what I have so far:</p>

<pre><code>var ref = new Firebase('https://url.firebaseio.com/');

ref.authWithPassword({
  "email": "email@gmail.com",
  "password": "******"
}, function(err, authData) {
  if (err) {
    console.log(err);
  } else {
    console.log("Authenticated successfully with payload:", authData);
  }
})
</code></pre>

<p>I get a message confirming my authentication was successful.  However, if I run something like ref.update({}), I get an error saying permission denied.  My Firebase security rules look like this: </p>

<pre><code>{
  "rules": {
    "users": {
      "$user_id": {
        ".read": "auth != null &amp;&amp; auth.uid == $user_id",
        ".write": "auth != null &amp;&amp; auth.uid == $user_id"
      }
    }
  }
}
</code></pre>

<p>Any advice is appreciated, thanks!</p>

<p>EDIT: Here is the code that I run that giving me the error.</p>

<pre><code>ref.on('value', function(snapshot){
            hsObject = snapshot.val();  //hsObject is the entire Firebase document
        }, function(err){
            hsObject = null;
            console.log('error:', err); //prints "error: Error: permission_denied at /: Client doesn't have permission to access the desired data."
        });
</code></pre>