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

497
Vistas
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 Respuestas
Responde la pregunta

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