firebase / firebase-android-sdk

Firebase Android SDK
https://firebase.google.com
Apache License 2.0
2.26k stars 572 forks source link

[auth] Not giving "password" providerId #6054

Open Lyokone opened 3 months ago

Lyokone commented 3 months ago

[REQUIRED] Step 2: Describe your environment

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

When sign in using email and password, the providerId is null, whereas on iOS it's "password". First reported here:https://github.com/firebase/flutterfire/issues/12985

Relevant Code:

    firebaseAuth
        .signInWithEmailAndPassword(email, password)
        .addOnCompleteListener(
            task -> {
              if (task.isSuccessful()) {
                // task.getResult().getAdditionalUserInfo().getProviderId() is null
              } else {
                result.error(
                    FlutterFirebaseAuthPluginException.parserExceptionToFlutter(
                        task.getException()));
              }
            });
lehcar09 commented 3 months ago

Hi @Lyokone, thank you for reaching out. I tried to reproduce the issue, however, I did not encounter an issue. I got the Provider ID:firebase upon using signInWithEmailAndPassword.

Screenshot 2024-06-25 at 3 34 36 AM

I'm thinking if the issue is occurs only in Flutter. We're you able to reproduce the issue with native Firebase Android SDK? If so, can you share the BOM version you're using?

TarekkMA commented 3 months ago

@lehcar09 I've created a reproduction here: https://github.com/TarekkMA/firebase-android-reproduction/tree/ff-issue/12985

The firebase BOM version is

    implementation(platform("com.google.firebase:firebase-bom:33.1.0"))

The provider id is null

lehcar09 commented 3 months ago

Thank you for the MCVE @TarekkMA. I was able to able to reproduce the issue. The provider ID shows null when retrieved with AdditionalUserInfo. I tried to retrieve the provider ID with auth.currentUser and task.getResult().getUser() and I was able to retrieve the Provider ID = firebase. I'll notify our engineers about this and see what we can do here.

In the meantime, I suggest using the either auth.currentUser and task.getResult().getUser() to get the user provider ID. Thanks!