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

Reauthenticate with email and password #486

Closed
bergergit opened this issue Aug 19, 2020 · 1 comment
Closed

Reauthenticate with email and password #486

bergergit opened this issue Aug 19, 2020 · 1 comment

Comments

@bergergit
Copy link

Feature request

Hello there!

When executing sensitive changes like updating an email or password, we need to reauthenticate users

Looking at the documentation, for Apple or Google sign in, we can get a credential using authenticateUserWithApple / authenticateUserWithGoogle and then use it to reauthenticate with credential

FirebasePlugin.authenticateUserWithApple(function(credential) {
    FirebasePlugin.reauthenticateWithCredential(credential, function() {
         console.log("Successfully reauthenticated");
    }, function(error) {
        console.error("Failed to reauthenticate", error);
    });
}, function(error) {
    console.error("Failed to sign in", error);
});

To reauthenticate users with email and password, we would need to create a credential by creating an EmailAuthProvider (Android and iOS) with Email and Password, and then pass it to the signInWithCredential above. But apparently, we can't create an EmailAuthProvider with the current plugin implementation.

Android example

AuthCredential credential = EmailAuthProvider
        .getCredential("user@example.com", "password1234");

// Prompt the user to re-provide their sign-in credentials
user.reauthenticate(credential)

From the documentation, I don't see a way to do this.
Is this feature really missing?

Thank you for your support!

@ianitsky
Copy link

Hi @bergergit I heaved this problem too.

The better solution is create a function that changes the user email and return a authentication token to you re-authenticate the user.

@dpa99c dpa99c added the ready for release Something has been implemented and is awaiting release to npm label Sep 15, 2020
@dpa99c dpa99c closed this as completed in dda8b57 Sep 15, 2020
@dpa99c dpa99c removed the ready for release Something has been implemented and is awaiting release to npm label Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants