Estoy aprendiendo base de fuego. ahora quiero cambiar la contraseña con reauthenticateWithCredential(). pero recibe un error como este.
TypeError: credential._getReauthenticationResolver no es una función
este el codigo:
import { getAuth, reauthenticateWithCredential, signInWithEmailAndPassword } from "firebase/auth"; const auth = getAuth(); const user = auth.currentUser; const credential = signInWithEmailAndPassword(auth, user.email, this.oldPassword); reauthenticateWithCredential(user, credential).then(() => { // User re-authenticated. console.log(credential) }).catch((error) => { console.log(error) });¿alguien puede indicar donde esta el error?
Tal vez todavía no esté del todo bien, pero pruébalo:
import { getAuth, reauthenticateWithCredential, EmailAuthProvider, } from "firebase/auth"; const auth = getAuth(); const user = auth.currentUser; try { const credential = EmailAuthProvider.credential( user.email, this.oldPassword ); reauthenticateWithCredential(user, credential).then(() => { // User re-authenticated. // Code... }); } catch (error) { console.log(error.message); }