firebase / FirebaseUI-iOS

iOS UI bindings for Firebase.
Apache License 2.0
1.51k stars 475 forks source link

No display name for users signed up by email in Firebase Auth #725

Closed Johnson145 closed 3 years ago

Johnson145 commented 5 years ago

My environment

Problem description

I'm using the pre-built UI of Firebase Auth. When a user signs up by email, the UI lets him/her enter the user name (label asks for the first and last name combined as one input). However, I can't see a way to get that information later on. Instead, the firebaseUser.displayName is nil for those users. That's not the way it's meant to be, is it?

morganchen12 commented 5 years ago

Are there any errors in console when signing in? Can you see those users' names in Firebase console?

Johnson145 commented 5 years ago

Thanks for your quick reply!

I don't get any error message. Everything else is working just fine: the user is logged in and I can access other information like the email address.

I can see the user along with e.g. the email address in the Firebase console, too. However, the Firebase console does not show the (display) name of any user in the first place, does it?

morganchen12 commented 5 years ago

Good point, it doesn't. Can you see the display name in the user's provider info? Also, what version of FirebaseUI are you using?

Johnson145 commented 5 years ago

No, the provider info does not provide that name either. It does contain only the providerID ("password"), the email and the userID which equals the email. The rest is nil.

I'm including the following FirebaseUI pods:

pod 'FirebaseUI/Auth'
pod 'FirebaseUI/Email'
pod 'FirebaseUI/Google'
pod 'FirebaseUI/Facebook'
pod 'FirebaseUI/Phone'

All of them using the latest version 8.0.2.

morganchen12 commented 5 years ago

Sounds like a bug. We'll investigate.

Johnson145 commented 5 years ago

Just found this issue: #262. Looks like my issue is a duplicate of the former one. The bug still seems to exist though.

Furthermore, I can confirm that firebaseUser.displayName seems to get updated later on. I managed to get the correct value in the didSignInWith callback. It's still not in sync with the provider data though. The latter does still contain the old displayName instead of the one provided when signing up by email. In each case, all of these values should get updated before triggering any callback in the first place, right?

andynovak12 commented 4 years ago

@morganchen12 I am also experiencing this issue. Is there an ETA of when this will be resolved?

morganchen12 commented 4 years ago

Hey, unfortunately I haven't had time to make significant contributions to this SDK in a while. We're in the middle of some reshuffling that will hopefully get us some more contributors to FirebaseUI, but between the reporting of this bug and now there hasn't been any progress made.

Sorry for the delays.

VedankPande commented 4 years ago

I've been getting the same problem, any updates from Google/Firebase? It was working just this morning though and the only change I made since then is update some dependencies. Could that be the issue?

SharpBCD commented 4 years ago

Problem is still there. Any updates? The name is required in the interface for creating a user but it is not available when getting the user back in admin

yuchenshi commented 4 years ago

@rosalyntan Would you mind taking a look at this one?

morganchen12 commented 3 years ago

This should be fixed in the latest version of FirebaseUI. Please let me know if that's not the case.

romrell4 commented 1 year ago

I'm still seeing the error in FirebaseUI 12 @morganchen12 :( After logging in using the email provider, the displayName is nil. If I log out and back in, it is then set to the correct value from the UI - so it sounds like the same race case discussed above

AntonOliinyk-TomTom commented 1 year ago

Have the same issue with the Apple id login. When I call Auth.auth().signIn(with: credentials) I got the result, but user.displayName is always nil. If I use auth with Google credentials it works just fine.

alsiesta commented 1 year ago

Have the same issue. Funny though, that when using connectAuthEmulator the locally emulated console does show the displayName and it can be easily edited.

cmederos commented 11 months ago

Still an issue at the end of 2023. Especially annoying considering the FIRAuthStateDidChangeListenerHandle does not include profile updates, nor is there an equivalent listener.

I've only been able to work around this by placing a delay in the the body of the auth listener if the display name is empty.

However, the complexity around the listener, delay, and rendering the UI accordingly is greater than the complexity avoided by using the prebuilt UI. We could use a better solution here...

morganchen12 commented 11 months ago

@cmederos the issue you're describing sounds like it originates in the upstream Firebase SDK. Please file a new issue there instead.