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

193
Visualizações
Firebase -- Cannot update user name when user is signin

I cannot update user name where user is sign in to website it doesnt addit to user account, on displaName it shows null.The user account is created succefully but without user name as i said

const onSubmit = async ({ name, email, password }) => {
    setIsLoading(true);
    try {
      await signup(email, password);
      await updateProfile(currentUser, {
        displayName: name,
      });

      setInterval(() => {
        <Redirect to="/" />;
      }, 5000);
    } catch (error) {
      setIsLoading(false);
      console.log(error);
    }
  };
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use .then().

       firebase
            .auth()
            .createUserWithEmailAndPassword(email, password)
            .then(() => {
                // do whatever in here
                setUserInfo()
                sendEmailVerification()
                setDisplayName()
                alert('Account created!')
            })
            .catch(error => {
                console.log(error)
                alert(error.message)
            })

Inside the setDisplayName(), you can set the displayName. In my case, I am using the firstName and lastName, which I am getting through my form.

const setDisplayName = () => {
        firebase
            .auth()
            .currentUser
            .updateProfile({
                displayName: firstName + ' ' + lastName
            })
            .then(() => {
                console.log('display name set')
            })
            .catch(error => {
                console.log(error)
                alert(error.message)
            })
    }
about 4 years ago · Juan Pablo Isaza 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