Flutterfire: [firebase_auth] Using FirebaseUser.reauthenticateWithCredential() triggers a Log out.

Created on 5 Jan 2020  路  4Comments  路  Source: FirebaseExtended/flutterfire

Describe the bug
Implementing a feature that requires the user to reAuthenticate.
I am handling the PlatformExceptions thrown by the FirebaseUser.reauthenticateWithCredential in order to catch and gracefully handle the errors such as ERROR_WRONG_PASSWORD.
However if the user enters an email that doesn't exist, my error handler receives a ERROR_USER_NOT_FOUND then Firebase logs the user out. Thus trigger my onAuthStateChanged handler. Is this a bug? Or a feature built in for security reasons? According to the docs, the reauthenticateWithCredential method shouldn't trigger a log out event.

To Reproduce
Attain the currently logged in user, then call reauthenticateWithCredential with a credential that points to an email that doesn't exist. Observe that Firebase then logs out.

Expected behavior
I don't believe it should be logging out the user on an incorrect re authentication attempt.

Additional context
Dependencies

firebase_auth 0.15.3. 
firebase_core 0.4.3+1
customer-response customer auth needs-repro bug

All 4 comments

Hi @Charlie9830 does this happen on both Android & iOS?

Hi @Ehesp,
Unfortunately I don't have the means to test this on iOS currently. Tomorrow I'll look into trying to create a small demonstration project that perhaps someone else can test on iOS.

Hi @Ehesp.

Here is a link to a Demo Repo.

https://github.com/Charlie9830/flutterfire-issue-1767-demo

It should be pretty easy to clone and run. The Master branch uses the same Firebase_Core and Firebase_Auth versions that my original project is on. The "Updated Firebase Dependencies" uses the most up to date versions available on pub. The bug exists in both branches.

I'm not sure if it affects things, but the google services plugin is 4.3.0 as opposed to 4.3.3.

Hey 馃憢

Our rework of the firebase_auth plugin as part of the FlutterFire roadmap was published over a week ago with a ton of fixes and new features. Please could you try the new version and see if this is still an issue for you? If it is then please submit a new up to date GitHub issue.

For help migrating to the new plugins please see the new migration guide: https://firebase.flutter.dev/docs/migration

Was this page helpful?
0 / 5 - 0 ratings