I'm using Firebase UI to sign-in the users of my app. When a Google user signs in, I would like to retrieve the profile picture (for use in my GUI). However, for all Google users the method FirebaseAuth.getInstance().getCurrentUser().getPhotoUrl()
returns null
.
Note that I'm setting the default Scope in the setup of Firebase-UI.
I'm sure that the Google accounts have a profile picture (it's even visible in dialog that appears after clicking the the "Sign in with Google" button).
Code in which I configure Firebase-UI:
startActivityForResult( AuthUI.getInstance()
.createSignInIntentBuilder()
.setTheme( R.style.AppTheme )
.setLogo( R.drawable.app_logo )
.setTosUrl(getSelectedTosUrl() )
.setIsSmartLockEnabled( false )
.setAvailableProviders( Arrays.asList(
new AuthUI.IdpConfig.GoogleBuilder().build(),
new AuthUI.IdpConfig.EmailBuilder().setRequireName( false ).build())
).build(), RC_SIGN_IN);
Code in which I try to retrieve the account image:
final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user.getPhotoUrl() != null){
Log.d(TAG, "Account image: user has a photoUrl: " + user.getPhotoUrl());
}
getPhotoUrl()
always returns null.