Skip to content

馃悰 [firebase_auth] Windows: reauthenticateWithCredential never completes on success#18632

Description

@JulianPscheid

Bug report

On Windows, User.reauthenticateWithCredential() never completes when the credential is valid. The returned Future stays pending forever. An invalid credential rejects normally.

FirebaseAuthPlugin::ReauthenticateWithCredential in the Windows plugin only invokes the Pigeon result callback on the error branch:

// windows/firebase_auth_plugin.cpp
firebase::Future<void> future =
    user.Reauthenticate(getCredentialFromArguments(input, app));

future.OnCompletion([result](const firebase::Future<void>& completed_future) {
  if (completed_future.error() == 0) {
    // TODO: wrong return type
  } else {
    result(FirebaseAuthPlugin::ParseError(completed_future));
  }
});

User::Reauthenticate() in the C++ SDK returns Future<void>, but the Pigeon signature expects an InternalUserCredential, so the success branch was left empty. Nothing calls result and the Dart side waits forever. It is the only method in the file that returns nothing on success: ReauthenticateWithProvider just below calls result(credential), and Reload deals with the same Future<void> shape by reading firebaseAuth->current_user() once the future completes and building the reply from that.

Steps to reproduce

  1. Run a Flutter Windows app with an email/password Firebase user signed in.
  2. Call:
final cred = EmailAuthProvider.credential(email: user.email!, password: correctPassword);
await user.reauthenticateWithCredential(cred);
print('never printed');
  1. Pass the correct password.

Expected

The future completes with a UserCredential, as it does on Android, iOS, macOS and web.

Actual

The future never completes, with no error and no exception. Anything awaiting it is stuck until the process exits.

A wrong password completes normally with a FirebaseAuthException, since the error branch calls result.

Impact

Any Windows flow that requires credential reauthentication first cannot complete. Ours is the account email-change flow, where reauthenticateWithCredential runs ahead of verifyBeforeUpdateEmail. The verification email is never requested and the user sees nothing happen. verifyBeforeUpdateEmail is implemented correctly, it just isn't reached.

Possible fix

Reload already shows the pattern for a Future<void> C++ call that has to return a richer Pigeon type: read the current user after completion and construct the reply from it.

Version

firebase_auth 6.5.7. The same code is in 6.6.1 (current latest) at the same place.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions