Problem:
I am facing an issue. I am using Firebase Auth UI in my android app. I have requested for email in GoogleSignInOptions.
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.web_client_id))
.requestEmail()
.build();
Passing this GoogleSignInOptions in login builder
new AuthUI.IdpConfig.GoogleBuilder()
.setSignInOptions(gso)
.build(),
Now when I do login by google in app, onActivityResult()
is called then I am unable to get Email by FirebaseUser.getEmail()
. While IdpResponse
contains email.
IdpResponse response = IdpResponse.fromResultIntent(data); // response.getEmail() returns email
Above IdpResponse
contains email.
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); // user.getEmail() is null
Above FirebaseUser
object does not contain email.
Purpose
I want have email in FirebaseUser object. Because there are other signIn providers too. Like facebook, email/pass, twitter. so I am searching for a unique solution.