diff --git a/packages/firebase_auth/firebase_auth/example/integration_test/firebase_auth_user_e2e_test.dart b/packages/firebase_auth/firebase_auth/example/integration_test/firebase_auth_user_e2e_test.dart index 0339d95da4d2..a092f79f5970 100644 --- a/packages/firebase_auth/firebase_auth/example/integration_test/firebase_auth_user_e2e_test.dart +++ b/packages/firebase_auth/firebase_auth/example/integration_test/firebase_auth_user_e2e_test.dart @@ -352,8 +352,14 @@ void main() { expect(e.code, equals('user-mismatch')); expect( e.message, - equals( - 'The supplied credentials do not correspond to the previously signed in user.', + anyOf( + equals( + 'The supplied credentials do not correspond to the previously signed in user.', + ), + // Windows C++ SDK omits the trailing period. + equals( + 'The supplied credentials do not correspond to the previously signed in user', + ), ), ); await FirebaseAuth.instance.currentUser!.delete(); //clean up @@ -428,38 +434,44 @@ void main() { fail('should have thrown an error'); }); - test('should throw wrong-password ', () async { - // Setup - final email = generateRandomEmail(); - await FirebaseAuth.instance.createUserWithEmailAndPassword( - email: email, - password: testPassword, - ); + test( + 'should throw wrong-password ', + () async { + // Setup + final email = generateRandomEmail(); + await FirebaseAuth.instance.createUserWithEmailAndPassword( + email: email, + password: testPassword, + ); - await FirebaseAuth.instance.signOut(); + await FirebaseAuth.instance.signOut(); - await expectLater( - FirebaseAuth.instance.signInWithEmailAndPassword( - email: email, - password: 'wrong password', - ), - throwsA( - isA() - .having((e) => e.code, 'code', equals('wrong-password')) - .having( - (e) => e.message, - 'message', - equals( - 'The password is invalid or the user does not have a password.', + await expectLater( + FirebaseAuth.instance.signInWithEmailAndPassword( + email: email, + password: 'wrong password', + ), + throwsA( + isA() + .having((e) => e.code, 'code', equals('wrong-password')) + .having( + (e) => e.message, + 'message', + equals( + 'The password is invalid or the user does not have a password.', + ), ), - ), - ), - ); - }); + ), + ); + }, + // Exercises signInWithEmailAndPassword, not reauthenticateWithCredential. + // A test-level skip overrides the group skip, so include macOS here too. + skip: !kIsWeb && + (defaultTargetPlatform == TargetPlatform.windows || + defaultTargetPlatform == TargetPlatform.macOS), + ); }, - skip: !kIsWeb && - (defaultTargetPlatform == TargetPlatform.windows || - defaultTargetPlatform == TargetPlatform.macOS), + skip: !kIsWeb && defaultTargetPlatform == TargetPlatform.macOS, ); group('reload()', () { diff --git a/packages/firebase_auth/firebase_auth/windows/firebase_auth_plugin.cpp b/packages/firebase_auth/firebase_auth/windows/firebase_auth_plugin.cpp index 7322e7a1879b..c6435554c858 100644 --- a/packages/firebase_auth/firebase_auth/windows/firebase_auth_plugin.cpp +++ b/packages/firebase_auth/firebase_auth/windows/firebase_auth_plugin.cpp @@ -1039,17 +1039,22 @@ void FirebaseAuthPlugin::ReauthenticateWithCredential( firebase::auth::Auth* firebaseAuth = GetAuthFromPigeon(app); firebase::auth::User user = firebaseAuth->current_user(); - firebase::Future future = - user.Reauthenticate(getCredentialFromArguments(input, app)); + firebase::Future future = + user.ReauthenticateAndRetrieveData( + getCredentialFromArguments(input, app)); - future.OnCompletion([result](const firebase::Future& completed_future) { - // We are probably in a different thread right now. - if (completed_future.error() == 0) { - // TODO: wrong return type - } else { - result(FirebaseAuthPlugin::ParseError(completed_future)); - } - }); + future.OnCompletion( + [result](const firebase::Future& + completed_future) { + // We are probably in a different thread right now. + if (completed_future.error() == 0) { + InternalUserCredential credential = + ParseAuthResult(completed_future.result()); + result(credential); + } else { + result(FirebaseAuthPlugin::ParseError(completed_future)); + } + }); } void FirebaseAuthPlugin::ReauthenticateWithProvider(