Firebase doesn't apply data rules after logging in
<p>I have a big but simple security problem with angularfire.</p>

<p><a href="https://jsfiddle.net/nicolas1000/ea0L9x44/" rel="nofollow">https://jsfiddle.net/nicolas1000/ea0L9x44/</a></p>

<p>You can also test it there :
<a href="http://nicolash.org/truc44/" rel="nofollow">http://nicolash.org/truc44/</a></p>

<p>well my goal is simply that as soon as any user log in, the Data Model appears in the application, (taking advantage of the 3 ways binding.) </p>

<p>I've got these security rules applied in the firebase dashboard :</p>

<pre><code>  {
  "rules": {
    // public read access
    ".read": false,
    "users": {
      "$uid": {
        ".read": "$uid === auth.uid",
        // write access only to your own data
        ".write": "$uid === auth.uid",
      }
    }
  }
}
</code></pre>

<p>The anonymous loggin session works </p>

<p>But, the rules don't apply. I can't see my "VILLES" data model appear on the page. </p>

<p>This is my unique controller, who works well :</p>

<pre><code>app.controller('appCtrl', ['$scope','$firebaseArray', "$firebaseAuth", function ($scope,$firebaseArray, $firebaseAuth) {


var ref = new Firebase("https://blinding-heat-8502.firebaseio.com/villes"); 
                auth = $firebaseAuth(ref);

                $scope.login = function() {
                  $scope.authData = null;
                  $scope.error = null;

                  auth.$authAnonymously().then(function(authData) {
                    $scope.authData = authData;
                    $scope.villes = $firebaseArray(ref);

                  }).catch(function(error) {
                    $scope.error = error;

                  });
                };
</code></pre>

<p>
}]) </p>

<p>I'm still getting this error, trying to fetch the data into $scope.villes, while i'm logged in successfully:</p>

<pre><code>Error: permission_denied: Client doesn't have permission to access the desired data.
</code></pre>

<p>My villes data structure look like this and is really simple : an Array of cities with one name that's all !:</p>

<pre><code>villes
-K7RMScvACBfJC_ebW1p  
 name : New York
</code></pre>

<p>Maybe i need to mention a $uid into eachs of the cities ? Please help thank you.</p>

<p><strong>EDIT :</strong> <em>Ok i think it's resolved ! Ouf !</em></p>

<p><strong>FIRST :</strong> Changed the Firebase rules to this :</p>

<p>{"rules": {"villes": {".read": "auth != null",".write": "auth != null"} }}</p>

<p><strong>SECOND :</strong> Under the LOGIN AND AUTH tab in the firebase dashboard, I've  Changed the session length to 20 seconds, and it works ! As soon as somebody isn't logged any more, he's not able to access the firebase branche called "VILLES" into firebase any more.</p>

<p>thanks a lot</p>