FirebaseUI-iOS icon indicating copy to clipboard operation
FirebaseUI-iOS copied to clipboard

user displayName and photoURL are nil when logging in via Google

Open yorgosg opened this issue 10 years ago • 4 comments

On logging in via Google, even though the "View your basic profile" permission is presented to me and I allow it, the user.displayName and the user.photoURL are returned nil in the didSignInWithUser method.

yorgosg avatar Nov 09 '16 22:11 yorgosg

@yramanchuk FYI

morganchen12 avatar Nov 09 '16 22:11 morganchen12

@yorgosg I know in Android I needed to loop through the providerData to get anything of value from social sign on accounts. Have you looked at ProviderData? (The iOS documentation actually looks worse than the Android...)

Here's my answer to this problem, in Android/Java.. I'd imagine it's the same concept, but I haven't gotten to it yet in iOS. Essentially, each provider (google, facebook, twitter) can be linked to a Firebase account and therefore have different display names and profile images etc. You need to loop through and check if there are any providers if the user.photoUrl / user.displayName was nil.

ahaverty avatar Nov 14 '16 16:11 ahaverty

@ahaverty I checked again and the providerData had all the info, like you said. I though I had looked there before, my bad. I am closing this, cheers guys.

yorgosg avatar Nov 15 '16 12:11 yorgosg

It might be worth raising an issue against Firebase's documentation, you're not the first person to hit this issue 👏

ahaverty avatar Nov 15 '16 12:11 ahaverty