javascriptfirebasereact-nativefirebase-authenticationreact-native-firebase

Deleting User account using Passwordless Authentication?


I have implemented passwordless SignUp/SignIn from firebase for my react-native app but I can't understand how will the delete account method work if it needs to be reauthenticated with a password or needs a recent SignIn to refresh the token??

In short, how should I use reauthenticateWithCredential() when I'm using Passwordless Authentication??


Solution

  • The Firebase documentation on Linking/re-authentication with email link has an example of how to get a credentials object from the email link/passwordless sign in:

    var credential = 
        firebase.auth.EmailAuthProvider.credentialWithLink(email, window.location.href);
    

    You can then pass this credential to your call to reauthenticateWithCredential.