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

244
Views
Firebase - email is not defined

I am trying to build a function that allows user to change their password. The problem is when I am getting the current user's data it shows that the email is null.

Everything works on Firebase, users are creating in Firebase auth system.

Here is a part of my code

reauthenticate = (currentPassword) => {
    var user = firebase.auth().currentuser;
    var cred = firebase.auth.EmailAuthProvider.credential(user.email, currentPassword);
    user.reauthenticateWithCredential(cred);
}

reauthenticate(currentPassword).then(() => {
    var user = firebase.auth().currentuser;
    user.updatePassword(newPassword).then(() => {
        alert("Password changed");
        window.location.replace("./index.html");
    }).catch((error) => {
        console.log(error);
    })
});

What console shows is Uncaught TypeError: Cannot read properties of undefined (reading 'email') at reauthenticate (password.js:15:64) at changePassword (password.js:27:9)

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

its currentUser not currentuser. Capital U.

const user = firebase.auth().currentUser;
about 4 years ago · Santiago Trujillo 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!