Alexandru Gheorghe
Alexandru Gheorghe

Reputation: 371

User authenticated with federated Google Sign In with Firebase has null email using Credential Manager in Android

I'm implementing the new fancy, shiny Credential Manager in my app using Jetpack Compose Material3. I'm building the credential request as per docs.

The sign in is successful, however, the user has email as null (when I access the property) and the email is not verified. In console I see a dash: dash when it comes to identifier (I suppose here should have been the email?).

Any clues as to why my app is not able to fetch the credential information of a user after sign in?

I've exhausted all links on the web with regards to this issue (most are older and deal with a different sign in library).


Debugging

I tried printing the user I get from signing in with google (AuthResult returned value), the email and whether it has email verified as well as additionalUserInfo profile and providerId and I get (I've redacted out information):

D  user: com.google.firebase.auth.internal.zzaf@86c120f // email: null // isEmailVerified: false // username: null // profile: {given_name={{FIRST_NAME}}, family_name={{LAST_NAME}}, picture=https://lh3.googleusercontent.com/a/..., aud=#.apps.googleusercontent.com, azp=#.apps.googleusercontent.com, exp=#, iat=#, iss=https://accounts.google.com, sub=#, name={{FULL_NAME}}, nonce=d8c25bb...} // providerId: google.com

So definitely the user gets created (as I can see it in Firebase Auth console), though it seems it's of empty data?

Upvotes: 2

Views: 141

Answers (1)

Alexandru Gheorghe
Alexandru Gheorghe

Reputation: 371

Running this command: https://firebase.google.com/docs/auth/admin/manage-users#update_a_user will solve the issue. It'll create an email & password user, though, signing in with Google will override provider and have the login succeed.

Upvotes: 1

Related Questions