FirebaseUI-Android: Email is null for Google Sign-in for some accounts
After a successful Google sign-in, I’m getting null when calling FirebaseAuth.getInstance().currentUser?.email
Other fields (displayName, uid) are there.
This is how I launch the Auth UI:
activity.startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.enableAnonymousUsersAutoUpgrade()
.setLogo(R.drawable.ic_splash_app)
.setTheme(R.style.LoginTheme)
.setIsSmartLockEnabled(false, true)
.setAvailableProviders(listOf(
AuthUI.IdpConfig.GoogleBuilder().build(),
AuthUI.IdpConfig.FacebookBuilder().build(),
AuthUI.IdpConfig.EmailBuilder().build()))
.setTosAndPrivacyPolicyUrls("https://settleup.io/privacy_policy.html", "https://settleup.io/privacy_policy.html")
.build(),
Ids.REQUEST_SIGN_IN)
It’s strange, because I’m only getting this behavior for some Google accounts. Others are fine. I also see email in the Firebase Console for all accounts.
My “One account per email address” is set to “Prevent creation of multiple accounts with the same email address”
This started to happen after I updated the library from version to version 2.0.1 to version 4.3.2.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (9 by maintainers)
I was experiencing this very issue a while ago (about the same time as the issue’s date). What fixed it for me was changing this:
to this:
It seemed as if I had to explicitly state I needed the email - after that I started getting the email addresses again. Hope it helps someone!