In my Flutter iOS app, the Firebase sign out of Google is failing. I use these lines to sign out of Google:
await GoogleSignIn().signOut(); await FirebaseAuth.instance.signOut();
Then I sign in with Apple. However, when I check the
FirebaseAuth.instance.currentUser.providerData, the google.com provider is still there in addition to the apple.com provider. Shouldn’t this google.com providerData be removed on
edit: My expectation is that the
FirebaseAuth.instance.currentUser.providerData will be a list of currently signed in authentication providers. Therefore, I expect that when I sign out of Google, the google.com
providerData entry would be removed. Maybe this expectation is wrong, and if so, how do I know what provider(s) the user is currently signed in with? So, for example, if I want to get the user’s name, how do I know which providerData to pull from?
My question stemmed from a misunderstanding of how
providerData works. I thought that it would contain the currently signed-in providers. Instead, it contains all the providers associated with a user in Firebase.
In order to record the username, I recorded the user’s name during the sign in process, when the app knows which provider is being signed in.
Answered By – jon
Answer Checked By – David Goodson (FlutterFixes Volunteer)