Skip to content
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

[firebase auth] FirebaseUser.reauthenticateWithCredential finished with NoSuchMethodError exception #76

Closed
hungnt-kayac opened this issue Sep 2, 2019 · 11 comments · Fixed by #237
Assignees
Labels
type: bug Something isn't working

Comments

@hungnt-kayac
Copy link

hungnt-kayac commented Sep 2, 2019

plugin version:

firebase_core: ^0.4.0+9
firebase_auth: ^0.14.0+5

here is the screenshot
Screen Shot 2019-09-02 at 19 58 26

@BondarenkoStas
Copy link

@hungnt-kayac Please provide a small self-contained app that demonstrates the problem. You can include small examples inline if they're enclosed by backticks, or just provide a public link to a github "gist" - https://gist.github.com/.
It's extremely tedious to reproduce the issue having code on a screenshot, as we would have to manually transcribe your example.

@BondarenkoStas BondarenkoStas added the type: question A question where further information is requested label Sep 11, 2019
@hungnt-kayac
Copy link
Author

@BondarenkoStas
i created a sample app here
https://github.com/nguyentuanhung/flutter_firebase_sample
(for some reason, i don't push the whole flutter project, just lib folder and pubspec.yaml file)

In this example, i login via email, password and then try to reauthenticate with provided email and password

@BondarenkoStas BondarenkoStas added type: bug Something isn't working and removed type: question A question where further information is requested labels Sep 19, 2019
@fabriziocacicia
Copy link

I have the same problem. But my situation is different.
I have an anonymous user that should be converted to an "email and password" one. By using linkWithCredential() and reauthenticateWithCredential() i encounter the same error as hungnt-kayac

@alexZaicev
Copy link

I experience the same problem, when I try to re-authenticate user it throw exception:

NoSuchMethodError: The method '[]' was called on null. Receiver: null Tried calling: []("user")

@pawlowskim
Copy link

Same here.

  Future<AuthResult> reAuthenticate(String email, String password) {
    return getFirebaseUser().then((FirebaseUser user) {
      AuthCredential credential =
          EmailAuthProvider.getCredential(email: email, password: password);
      return user.reauthenticateWithCredential(credential);
    });
  }

If password is correct it throws:

I/flutter (14968): Error: NoSuchMethodError: The method '[]' was called on null
I/flutter (14968): Receiver: null
I/flutter (14968): Tried calling: []("user")

If password is incorrect it returns error (expected):

flutter: PlatformException(ERROR_WRONG_PASSWORD, The password is invalid or the user does not have a password., null)

@fabriziocacicia
Copy link

@pawlowskim I've done a PR (#237) that should fix this error. I'm waiting for the code review.

@feinstein
Copy link
Contributor

feinstein commented Nov 19, 2019

I am still getting the NoSuchMethodError: The method '[]' was called on null., even after updating to version 0.15.0 and running pub get.

W/BiChannelGoogleApi(32652): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzak@1805007
D/FirebaseAuth(32652): Notifying id token listeners about user ( xxxxxxxxxxxxxxxxxxxxxxxxxxxxx ).
I/flutter (32652): NoSuchMethodError: The method '[]' was called on null.
I/flutter (32652): Receiver: null
I/flutter (32652): Tried calling: []("user")

@fabriziocacicia
Copy link

@feinstein have you tried a flutter clean?

@feinstein
Copy link
Contributor

@fabryx92 no I didn't, but I expected pub to respect the minimum version and, pubspec.lock has the right version, but I will give it a try and let you know.

@feinstein
Copy link
Contributor

feinstein commented Nov 19, 2019

I did a flutter clean > pub get > pub upgrade > Stopped and Restarted the App > Confirmed pubspec.lock has firebase_auth 0.15.0+1 and it worked, thanks @fabryx92

@fabriziocacicia
Copy link

@feinstein awesome! I think a previous version of the package was cached, sometimes this happens even after doing pub get.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working
Projects
None yet
7 participants