To delete/edit the information of a user in firebase auth, you need to have recently logged in. This can be done with .reauthenticateWithCredential(). How can I make the credential for this (using email auth) in javascript? I have tried with (email, password) and ({email, password}), but no luck.
Code:
function reauth() {
const credential = firebase.auth.EmailAuthProvider.credential(user.auth.email, password);
user.reauthenticateWithCredential(credential).then(function() {
firebase.firestore().collection('users').doc(uid).delete().then(() => {
user.delete().then(function() {
navigation.replace("Signup")
}).catch(function(error) {
console.log(error)
})
}).catch((error) => {
console.log(error)
})
}).catch(function(error) {
console.log(error)
})
}