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

495
Views
How to check current password when reset password in firebase and Expo?

I'm adding password reset function using react native expo and firebase api.

UI link

First input is current password.

Second input is new password.

And third input is confirm new password.

To check the current password, I have to get current password.

Please help me!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use reauthenticateWithCredential() to verify user's password and then updatePassword() to update it:

import { getAuth, reauthenticateWithCredential, EmailAuthProvider } from "firebase/auth";

const auth = getAuth();

const resetUserPassword = async () => {
  const user = auth.currentUser;

  const cred = EmailAuthProvider.credential(user.email, "[USER_PASSWORD]");

  try {
    await reauthenticateWithCredential(user, cred)
   
    // User entered correct credentials
    // Update password
    await updatePassword(auth.currentUser, "[NEW_PASSWORD]");
  } catch (e) {
    console.log(e.code, e.message)
    // Could be incorrect credentials
  }
} 

Updating password requires a recent login re-authentication is necessary if user is logged in for long time.

over 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!