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

213
Visualizações
Problems Verifying Phone Number with Firebase (MFA)

I’m trying to verify a phone number with Firebase when enrolling for Multi-Factor Authentication. I have a simple HTML and JavaScript app where I want to enable MFA for an already logged in user. That is, the user is not enrolling in MFA at login—they are enrolling through their profile at a later time. I’m following the instructions here:

https://cloud.google.com/identity-platform/docs/web/mfa

I can initialize the RecapatchVerifier successfully (step 3) and create a multiFactorSession (step 4) and initialize PhoneInfoOptions (step 5). However, when I try to verify the number with a PhoneAuthProvider (step 6), it throws an "auth/internal-error". I think this is because I'm not passing the right phone options (see below). Is the phoneNumber property deprecated? I can't find any other documentation on this that doesn't require a resolver hint (“[s]ign the user in with their first factor, then catch the auth/multi-factor-auth-required error. This error contains a resolver, hints on the enrolled second factors, and an underlying session proving the user successfully authenticated with the first factor.”), which I can't use because there is no error, I'm enrolling for the first time.

function twoFactor(new_phone) {
            console.log("got the phone number, start enrolling in 2FA
");
            multiFactor(user)
                .getSession()
                .then((multiFactorSession) => {
                    console.log('1')
                    // Is this the right object to use when enrolling a new MFA?
                    const phoneInfoOptions = {
                        phoneNumber: new_phone,
                        session: multiFactorSession
                    }
                    const phoneProvider = new PhoneAuthProvider(auth)
                    return phoneProvider.verifyPhoneNumber(phoneInfoOptions, recapatchaVerifier) //error happens on the return
                    // This promise creates an auth/internal-error
                }).then(verificationId => {
                    console.log('2')
                    const credential = PhoneAuthProvider.credential(verificationId, window.prompt('Enter your code'))
                    const assertion = PhoneMultiFactorGenerator.assertion(credential)
                    return multiFactor(user).enroll(assertion)
                })
        }

Error:

enter image description here

about 4 years ago · Santiago Trujillo
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