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

180
Visualizações
Firebase multifactor auth - Error object not returning resolver

I'm trying to add MFA inside my web app following the guide https://cloud.google.com/identity-platform/docs/web/mfa.

I started with enrolling the phone number successfully with the account and now when I want to "login" again using that phone number but I can’t use the number to get a code.

Check the code:

//I have imported my firebase services inside services/firebase.js
import { auth, signInWithEmailAndPassword, PhoneMultiFactorGenerator } from '@/services/firebase';
methods: {
  //On login button click - this method is called
  login: async function (event) {
    var self = this;
    await signInWithEmailAndPassword(auth, self.user_email, self.user_password)
    .then(()=> {
      ...
      //I am setting the user here, and giving access based on the role of the user
    }
    .catch((error) => {
          console.log('Error:', error);
          //Gives: Error: FirebaseError: Firebase: Error (auth/multi-factor-auth-required).
          if (error.code == 'auth/multi-factor-auth-required') {
            self.resolver = error.resolver;
            //assigning to my data field so I can use this later with my phone number verification
            console.log(error.resolver);
            //UNDEFINED
            ...
          } else {
           ...
          }
        });
  }
}

In the code above the error object does not have a resolver, so "error.resolver" is undefined which I need in a later stage. (FYI:- I am not using the Multi-Tenancy option)

UPDATE: Solved

The docs (https://cloud.google.com/identity-platform/docs/web/mfa) are outdated and functions are changed now.

Now the resolver doesn't come from the error object, we just need to call the resolver using a firebase function

getMultiFactorResolver

resolver = getMultiFactorResolver(auth, error);

Have a look here and you will undestand everything: https://firebase.google.com/docs/reference/js/auth.multifactorresolver#example_2

about 4 years ago · Juan Pablo Isaza
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