Here's another straw to grab at ...
- There's a Firebase block, Unauthenticate. I vaguely remember it being the solution to problems involving interactions between multiple connections on multiple buckets across multiple screens, like this project has. (I haven't found the original thread and reference yet.)
Unauthenticate from Firebase.
Firebase keeps track of credentials in a cache in shared_prefs It will re-use these credentials as long as they are valid. Given That we retrieve a FirebaseToken with a version long life, this will effectively be forever. Shared_prefs survive an application update and depending on how backup is configured on a device, it might survive an application removal and reinstallation.
Normally this is not a problem, however if we change the credentials used, for example the App author is switching from one Firebase account to another, or invalided their firebase.secret, this cached credential is invalid, but will continue to be used, which results in errors.
This function permits us to unauthenticate, which tosses the cached credentials. The next time authentication is needed we will use our current FirebaseToken and get fresh credentials.