Skip to content

Phone Auth crashes with "Already resumed" in DefaultVerifier.onVerificationCompleted #2446

Description

@tatuas

Environment

  • Devices: multiple devices
  • Android versions: 11–17
  • FirebaseUI Auth: 10.0.0-beta03
  • Firebase Auth: 24.0.1

Description

Our Android app crashes during Phone Authentication when Firebase automatically completes verification after detecting the SMS verification code.

The crash is fatal on the main thread and prevents affected users from signing in with SMS.

Steps to reproduce

  1. Configure FirebaseUI Phone Auth:

    AuthProvider.Phone(
        defaultNumber = null,
        defaultCountryCode = "<country>",
        allowedCountries = listOf("<country>"),
    )
  2. Start phone number verification.

  3. Receive the verification SMS.

  4. In affected cases, Firebase automatically detects the SMS code and completes verification.

  5. The app crashes.

Observed result

Fatal Exception: java.lang.IllegalStateException: Already resumed
    at kotlin.coroutines.SafeContinuation.resumeWith(SafeContinuationJvm.kt:44)
    at com.firebase.ui.auth.configuration.auth_provider.AuthProvider$Phone$DefaultVerifier$verifyPhoneNumber$2$options$1.onVerificationCompleted(AuthProvider.kt:418)
    at com.google.firebase.auth.zzl.onVerificationCompleted(com.google.firebase:firebase-auth@@24.0.1:6)
    at com.google.android.gms.internal.firebase-auth-api.zzaga.onVerificationCompleted(com.google.firebase:firebase-auth@@24.0.1:8)
    at com.google.android.gms.internal.firebase-auth-api.zzafi.zza(com.google.firebase:firebase-auth@@24.0.1:2)
    at com.google.android.gms.internal.firebase-auth-api.zzafn.run(com.google.firebase:firebase-auth@@24.0.1:4)

DefaultVerifier wraps Phone Auth callbacks with a single suspendCoroutine continuation. It resumes that continuation from onVerificationCompleted, onVerificationFailed, and onCodeSent.

The exception indicates that onVerificationCompleted attempted to resume a continuation that had already been completed by another callback. This may occur when onCodeSent is followed by SMS auto-retrieval.

Expected result

Phone verification should either complete automatically or transition to manual code entry without crashing. Any callback received after a terminal result should be safely ignored.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions