-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Deleted App's Database Being Returned #160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
When a FIRApp is deleted in Core, it should also be deleted from the instances array in Database. See #160 for more details.
Sorry, was on vacation the past week. Getting back to this now! |
@dylancopeland the PR (#194) should fix the issue but I wanted to check - what's the use case / reason for deleting |
@ryanwilson Awesome, thank you! Our data is sharded across a few Firebase projects. When a user authenticates against a new |
Okay great, thanks for the reply. I created a new issue (#202) to investigate some of the other SDKs as well to make sure we're cleaning up properly. For your use case, I'd just suggest making sure that when you delete the Thanks for reporting this! I'll close it when #194 is closed. |
* Delete an app from Database when deleted in Core. When a FIRApp is deleted in Core, it should also be deleted from the instances array in Database. See #160 for more details. * Add tests for deleting databases. * Add call to clean up deleted FIRDatabase instance.
Thanks again for reporting, @dylancopeland. |
* Delete an app from Database when deleted in Core. When a FIRApp is deleted in Core, it should also be deleted from the instances array in Database. See firebase#160 for more details. * Add tests for deleting databases. * Add call to clean up deleted FIRDatabase instance.
After getting a database reference and deleting the associated app, Firebase will always return the same instance to the initial database for an app's lifecycle.
The issue lies within
FIRDatabase
: https://github.com/firebase/firebase-ios-sdk/blob/master/Firebase/Database/Api/FIRDatabase.m#L122.The
instances
array will hold an outdated reference of the database. The outdated database can point to a then deletedFIRApp
. Perhaps when aFIRApp
is deleted, any databases it owns should be removed from theinstances
array.Steps to reproduce:
1.) Create a Firebase app with a specific name.
2.) Authenticate against the app.
3.) Get a Firebase database reference.
4.) Sign out.
5.) Delete the Firebase app.
6.) Create a Firebase app using the same name used in step 1.
7.) Authenticate against the Firebase app created in step 6.
8.) Get a Firebase database reference with
databaseForApp:
using the app created in step 6.The final Firebase database reference's app will actually point to the app created in step 1. This causes the database's authentication chain to break. Since the user is authenticated with the app created in step 6, the user will not be able to use the database.
The text was updated successfully, but these errors were encountered: