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

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

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