Skip to content

[firebase_auth] Using FirebaseUser.reauthenticateWithCredential() triggers a Log out. #1767

@Charlie9830

Description

@Charlie9830

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocked: customer-responseWaiting for customer response, e.g. more information was requested.impact: customerA bug with low impact (e.g. affecting only a few customers or has a workaround). (P3)plugin: authresolution: needs-reproThis issue could not be reproduced or needs an up to date reproduction on latest FlutterFire plugin.type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions