Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

245
Vistas
Cannot read properties of undefined (reading 'credential') Firebase Auth ReactJS

I am trying to confirm the user password again before the user tries to change the password.

Currently, my Firebase Auth project is configured in Firebase.js and is exported correctly

//appConfig = ...(all the configurations here)
const app = firebase.initializeApp(appConfig);

const projectAuth = app.auth()

export { projectAuth }

And in my PasswordManager.js, I use that exported projectAuth:

import { projectAuth } from "../firebase";

        const authenticateCurrentPassword = async (currentPassword) => {

        try {
            const cred = projectAuth.EmailAuthProvider.credential(
                projectAuth.currentUser.email, currentPassword);
            projectAuth.reauthenticateWithCredentials(cred)
            await projectAuth.reauthenticateAndRetrieveDataWithCredential(cred);
            dispatchIfNotCancelled( {type: 'AUTHENTICATED'})
            return true
        }
        catch (err) {
            console.log(err)
            dispatchIfNotCancelled( {type: 'ERROR'})
        }
    }

On the line where I am trying to initialize the "cred", it gives me an error saying that credential doesn't exist:

"TypeError: Cannot read properties of undefined (reading 'credential')"

I know that credential is a function inside EmailAuthProvider. btw: I'm using "firebase": "^7.24.0", if that does any help.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

this is what worked for me mind you am using angular 13 with angular/fire 7.2

i imported EmailAuthProvider direcly from 'firebase/auth'

so my code looked like const credentials = EmailAuthProvider.credential(user.email, password.old);

i hope this helps

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda