Skip to content

[firebase_auth] Fix NoSuchMethodError exception in reauthenticateWithCredential #237

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

Merged
merged 15 commits into from
Nov 18, 2019
Merged
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
6 changes: 6 additions & 0 deletions packages/firebase_auth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.15.0

* Fixed `NoSuchMethodError` in `reauthenticateWithCredential`.
* Fixed `IdTokenResult` analyzer warnings.
* Reduced visibility of `IdTokenResult` constructor.

## 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 @@ -491,8 +491,8 @@ private void handleReauthenticateWithCredential(
AuthCredential credential = getCredential((Map<String, Object>) call.arguments());

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

private void handleUnlinkFromProvider(MethodCall call, Result result, FirebaseAuth firebaseAuth) {
Expand Down
10 changes: 9 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,15 @@ void main() {
await auth.fetchSignInMethodsForEmail(email: testEmail);
expect(methods.length, 1);
expect(methods[0], 'password');
await user.delete();
final 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
8 changes: 5 additions & 3 deletions packages/firebase_auth/ios/Classes/FirebaseAuthPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,11 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
} else if ([@"reauthenticateWithCredential" isEqualToString:call.method]) {
[[self getAuth:call.arguments].currentUser
reauthenticateAndRetrieveDataWithCredential:[self getCredential:call.arguments]
completion:^(FIRAuthDataResult *r,
NSError *_Nullable error) {
[self sendResult:result forObject:nil error:error];
completion:^(FIRAuthDataResult *authResult,
NSError *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/lib/src/firebase_user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class FirebaseUser extends UserInfo {
'app': _app.name,
});

return IdTokenResult(data, _app);
return IdTokenResult._(data);
}

/// Associates a user account from a third-party identity provider with this
Expand Down
5 changes: 1 addition & 4 deletions packages/firebase_auth/lib/src/id_token_result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ part of firebase_auth;
/// Only server side verification can guarantee the integrity of the token
/// claims.
class IdTokenResult {
@visibleForTesting
IdTokenResult(this._data, this._app);

final FirebaseApp _app;
IdTokenResult._(this._data);

final Map<dynamic, dynamic> _data;

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.15.0

flutter:
plugin:
Expand Down