I use a simple AngularJS service to detect if the user is logged in or not using the authenticated key stored in the local storage. If the user is authenticated, then the app reaches firebase to grab the data.
This works fine for logging in users and logging them out. The problem is when the the session expires automatically, the app tries to grab the data without knowing that the session has expired and that returns an error due to the security rules.
$firebase(dataBase.child(permanentStorage['uid']).child('Notes')).$asArray();
// var permanentStorage = window.localStorage;
I couldn't find any ways to add a callback function to the code above.
$asArray()loads the data?