Angularjs firebase onAuthStateChanged throws a database error

When I exit the application, I get this error:

Error: permission_denied at /users/KuehJHDJ15SfS1s6FIh1: Client doesn't have permission to access the desired data.

 at G (firebase.js:432)
    at Object.G (firebase.js:456)
    at Pg (firebase.js:398)
    at Eg.g.wd (firebase.js:391)
    at sg.wd (firebase.js:381)
    at bg.hg (firebase.js:379)
    at eg (firebase.js:363)
    at WebSocket.La.onmessage (firebase.js:362)

I suspect my question is very much related to this: Refs not reerunning after changes to onAuthStateChanged Firebase 3.0.0

here are my safety rules:

{
  "rules": {
    "users": {
      ".read": "auth != null && root.child('hashlist/'+root.child('users/'+auth.uid+'/hash').val()).val() == auth.email",
      ".write": "auth != null"
    },
    "hashlist": {
      ".read": true,
      ".write": "auth != null && root.child('users/'+auth.uid+'/role').val() == 'admin'"

    }
  }
}

I would appreciate your help, thanks.

+1
source share
1 answer

Errors are displayed due to the presence of links that continue to listen to changes after they exit the system, and after they fail, the security rules prevent them from doing this.

, off , .

; . :

  • $scope.$on("$destroy", ...), , ( , Angular JS, ).
  • , once , .
  • AngularFire, ( ), .
+3

Source: https://habr.com/ru/post/1668408/


All Articles