Skip to content

[firebase_auth] Fix reauthenticateWithCredential #1451

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/firebase_auth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.14.0+11

* Fixed behavior of `reauthenticateWithCredential`.
* Added integration test for `reauthenticateWithCredential`.

## 0.14.0+10

* Formatted lists in member documentations for better readability.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ private void handleReauthenticateWithCredential(

currentUser
.reauthenticate(credential)
.addOnCompleteListener(new TaskVoidCompleteListener(result));
.addOnCompleteListener(new SignInCompleteListener(result));
}

private void handleUnlinkFromProvider(MethodCall call, Result result, FirebaseAuth firebaseAuth) {
Expand Down
9 changes: 8 additions & 1 deletion packages/firebase_auth/example/test/firebase_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,14 @@ void main() {
await auth.fetchSignInMethodsForEmail(email: testEmail);
expect(methods.length, 1);
expect(methods[0], 'password');
await user.delete();
AuthResult renewResult = await result.user.reauthenticateWithCredential(
EmailAuthProvider.getCredential(
email: testEmail,
password: testPassword,
),
);
expect(renewResult.user.uid, equals(user.uid));
await renewResult.user.delete();
});

test('isSignInWithEmailLink', () async {
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_auth/ios/Classes/FirebaseAuthPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
reauthenticateAndRetrieveDataWithCredential:[self getCredential:call.arguments]
completion:^(FIRAuthDataResult *r,
NSError *_Nullable error) {
[self sendResult:result forObject:nil error:error];
[self sendResult:result forAuthDataResult:authResult error:error];
}];
} else if ([@"linkWithCredential" isEqualToString:call.method]) {
[[self getAuth:call.arguments].currentUser
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_auth/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Flutter plugin for Firebase Auth, enabling Android and iOS
like Google, Facebook and Twitter.
author: Flutter Team <[email protected]>
homepage: https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_auth
version: 0.14.0+10
version: 0.14.0+11

flutter:
plugin:
Expand Down