Skip to content

Firebase Auth signInWithCredentials Blocking Indefinitely/Not Failing  #2765

Open
@GEverding

Description

@GEverding

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository.
If you have a general question, need help debugging, or fall into some
other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the firebase-talk
    google group.
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 4.1.1
  • Firebase Component: Authentication
  • Component version: com.google.firebase:firebase-bom:28.1.0

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

For 5000+ users per day signinWithCredential is never completing/erroring when using listeners. If I instead call Task.await with a 60 second timeout the TimeoutException is thrown. Since rewriting the login code hasn't changed the behaviour we need help debugging it.

If we tell them to install Cloudflare 1.1.1.1 they can log into the app. We then ask them to disable 1.1.1.1 and relogin and it works fine. Additionally at the same time we have other API requests so we don't believe the issue is network related.

We haven't figured out to reproduce it locally. Its effecting users across the globe with no patterns to OS version or phone. What I do observe is that it either completes instantly or not at all.

It feels like there is a bug getting hit inside the auth sdk that is preventing the Task from failing/completing. Are there any logs in the SDK or a way for us to debug this because its a real issue our users are facing.

Relevant Code:

Version 1

FirebaseAuth.getInstance().signInWithCredential(credential)
  .addOnCompleteListener(taskExecutor, new OnCompleteListener<AuthResult>() {
    @Override
    public void onComplete(@NonNull Task<AuthResult> task) {
      if (task.isSuccessful()) {
        RaveLogging.i(LOG_TAG, "FirebaseAuth:signInWithCredential successful");
        handleFirebaseUser(FirebaseAuth.getInstance().getCurrentUser());
     } else {
       Logging.e(LOG_TAG, task.getException(), "FirebaseAuth:signInWithCredential failed");
       FirebaseCrashlytics.getInstance().recordException(task.getException());
       onLoginFailure(FIREBASE_AUTH_ERROR_CODE, getString(R.string.auth_failed));
     }
   }
});

Version 2

try {
  Tasks.await(FirebaseAuth.getInstance().signInWithCredential(credential), 60, TimeUnit.SECONDS);
  Logging.i(LOG_TAG, "FirebaseAuth:signInWithCredential successful");
  handleFirebaseUser(FirebaseAuth.getInstance().getCurrentUser());
  RaveLogging.i(LOG_TAG, "FirebaseAuth task succeeded: signInWithFirebase");
} catch (ExecutionException | InterruptedException | TimeoutException e) {
  RaveAnalytics.sendUniqueEvenAnalytics(new PlaybackInfo(), "nonfatal", "FIREBASE_AUTH_TIMEOUT", e.getMessage());
  ogging.e(LOG_TAG, e, "Await FirebaseAuth:signInWithCredential failed with exception: " + e.getMessage());
  FirebaseCrashlytics.getInstance().recordException(e);
  onLoginFailure(FIREBASE_AUTH_ERROR_CODE, getString(R.string.auth_failed));
   Logging.i(LOG_TAG, "GoogleAuthServer task failed: signInWithFirebase");
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions