Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

252
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!