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

291
Visualizações
createUser doesn't work on Firebase/Auth + Next.js

I'm working on email + password authentication on Firebase Auth + Next js. But I would like to use a dedicated uid for authentication this time. So I think I should use createUser better than createUserWithEmailAndPassword. However, the error occurs like below:

Property 'createUser' does not exist on type 'Auth'.

import { getAuth, createUserWithEmailAndPassword } from 'firebase/auth'

      const auth = getAuth()
      const newId = XXXXXXXXXXXXXx 
     
      getAuth()
      .createUser({
        uid: newId,
        email: data.email,
        password: data.password,
      })
      .then((userRecord) => {
        // See the UserRecord reference doc for the contents of userRecord.
        console.log('Successfully created new user:', userRecord.uid);
      })
      .catch((error) => {
        console.log('Error creating new user:', error);
      });

      // It works
      createUserWithEmailAndPassword(auth, data.email, data.password)
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

To createUser you need to use firebase-admin SDK.

With node.js, install it with npm install firebase-admin. Then:

const admin = require("firebase-admin");
const newId = XXXXXXXXXXXXXx;

admin.auth().createUser({
  uid: newId,
  email: data.email,
  password: data.password,
})
.then(function(userRecord) {
  // See the UserRecord reference doc for the contents of userRecord.
  console.log("Successfully created new user:", userRecord.uid);
})
.catch(function(error) {
  console.log("Error creating new user:", error);
});

See Admin SKD user reference for more.

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