Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

243
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda