Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect error code returned for disabled user sign-in. #1725

Closed
danielfaust opened this issue Dec 19, 2019 · 2 comments
Closed

Incorrect error code returned for disabled user sign-in. #1725

danielfaust opened this issue Dec 19, 2019 · 2 comments

Comments

@danielfaust
Copy link

Step 2: Describe your environment

  • Android device: Pixel 3
  • Android OS version: 10
  • Google Play Services version: 19.8.31
  • Firebase/Play Services SDK version: core:17.2.1, auth:19.2.0
  • FirebaseUI version: 6.0.2

Step 3: Describe the problem:

When signing in by using the account of a deactivated user, IdpResponse returns an error code of 5, yet error code for ERROR_USER_DISABLED in ErrorCodes.java has a value of 12, while code 5 means ANONYMOUS_UPGRADE_MERGE_CONFLICT

public static final int ERROR_USER_DISABLED = 12;

Steps to reproduce:

Deactivate a user in the Firebase Console, try to sign in with that user by using FirebaseUI-Android

Observed Results:

IdpResponse.fromResultIntent(data).getError().getErrorCode() returns a value of 5
The message of .getError().toString() is "com.firabase.ui.auth.FirebaseUiException: User account merge conflict"

Expected Results:

IdpResponse.fromResultIntent(data).getError().getErrorCode() returns a value of 12

Relevant Code:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  if (requestCode == RC_SIGN_IN) {
      final IdpResponse response = IdpResponse.fromResultIntent(data);
      if (resultCode == RESULT_OK) {
          final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
          user.getIdToken(false).addOnCompleteListener(new OnCompleteListener<GetTokenResult>() {
              @Override public void onComplete(@NonNull Task<GetTokenResult> task) {
                  MyFirebaseManager.analyzeUser("on_activity_result", user, task, response.isNewUser());
              }
          });
      }
      else {
          // Sign in failed. If response is null the user canceled the
          // sign-in flow using the back button. Otherwise check
          // response.getError().getErrorCode() and handle the error.
          // ...
          if (response == null) {
              MyFirebaseManager.signInCancelled();
          }
          else {
              FirebaseUiException thing = response.getError();
              MyFirebaseManager.signInFailed(response.getError().getErrorCode()); // <----
          }
      }
   }
}
@samtstern
Copy link
Contributor

@danielfaust thanks for reporting this! Sorry for the delayed response, I was out for the holidays. This sounds like a bug.

@samtstern
Copy link
Contributor

The fix for this issue has been released in version 6.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants