iOS version: 11.4
Firebase SDK version: FirebaseCore 5.5.0
FirebaseUI version: 5.2.0
CocoaPods Version: 1.5.3
When FUIAuth.defaultAuthUI()?.shouldAutoUpgradeAnonymousUsers = true, calling Auth.auth().currentUser?.providerData[0] from func authUI(_ authUI: FUIAuth, didSignInWith authDataResult: AuthDataResult?, error: Error?) results in a nil value.
So the display name and photoURL are not reachable. If the anonymous users bit is set to false, then providerData is no longer empty and works as expected.
providerData is an empty array []
providerData should have length 1 with the login information after signing in with a firebase UI login provider.
Hi, any updates on this one?
I won't have time to look at it this week, but will try to address this next week.
Okay thanks!
After combing through the code, I'm not entirely sure if this is a bug in FirebaseUI (don't worry though, we can still push fix for it upstream). Does refreshing the user correctly populate the providerData dictionary?
Debugged a little more, so if the authUI.shouldAutoUpgradeAnonymousUsers = false, the user is signed in through the provider and providerData is set, but if authUI.shouldAutoUpgradeAnonymousUsers = true, then the user is still an anonymous user even after logging in through a provider.
More detail - this only happens on trying to sign in to an account that already exists and was upgraded. On trying to upgrade an account for the first time to a provider account that's never been used, it hangs on login, but the account is upgraded and visible in the Firebase console. It's just stuck with the spinner and never actually enters into func authUI(_ authUI: FUIAuth, didSignInWith authDataResult: AuthDataResult?, error: Error?).
Sorry if this is getting messy...let me know if I can provide any other info.
authDataResult is nil in func authUI also
Looking at the project, it looks like it's missing several files (fonts/images) and doesn't build off of a clone. I can replace these with placeholders for now.
Ah, sorry, I've mostly been working locally so didn't sync every file. But let me know if I can help with anything.
Hi, I'm having the same issues here.
When I enable shouldAutoUpgradeAnonymousUsers it does convert the anonymous user to a permanent user if it did not exist but won't call the func authUI(_ authUI: FUIAuth, didSignInWith authDataResult: AuthDataResult?, error: Error?) auth delegate method.
Also, when I try to sign in still with shouldAutoUpgradeAnonymousUsers enabled from an anonymous user to an existing user, it does call the delegate method and I'm catching the mergeConflict error. This is what I expect to happen but I also expect authDataResult to not be nil, otherwise how am I supposed to sign in the existing user?
Let me now if I can help with anything 馃憤
Thanks for the update! Does #512 also populate authDataResult even if there's a mergeConflict error?
No. The docs around this are _exceedingly_ poor, but the merge conflict error basically means the two accounts can't be properly joined, since they both have their own separate account state that can't be resolved cleanly. So in the case of this error your account is still anonymous and the login has failed, and providerData being empty is intentional.
In the case where this error arises, you should take the auth credential out of the userInfo dictionary of the error and use it to sign in, discarding the state of the anonymous user in favor of the user that your app user is trying to login as.
I'll submit a PR for the docs shortly.
The fix has been released in 5.2.1.
Most helpful comment
More detail - this only happens on trying to sign in to an account that already exists and was upgraded. On trying to upgrade an account for the first time to a provider account that's never been used, it hangs on login, but the account is upgraded and visible in the Firebase console. It's just stuck with the spinner and never actually enters into func authUI(_ authUI: FUIAuth, didSignInWith authDataResult: AuthDataResult?, error: Error?).
Sorry if this is getting messy...let me know if I can provide any other info.