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

315
Visualizações
Instruct locally emulated firebase function to use authentication emulator

I am using firebase emulator suite to test my app. I have set up emulators for hosting, authentication, firebase and functions.

When I try to create a user from front-end using firebase.auth().createUserWithEmailAndPassword() it works fine.

All other emulators work as expected too..

I am able to call a callable function from my front-end:

in public/app.js

const createUser = functions.httpsCallable('createUser');
createUser({
    username: username,
    email: email,
    password: password,
})

in functions/index.js

const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();

exports.createUser = functions.https.onCall((data, context) => {
    // creates a new user
    return admin.auth().createUser({
        email: data.email,
        emailVerified: false,
        password: data.password,
        displayName: data.username,
        disabled: false
    });
});

This function gets called, however it does not create a user on the auth emulator, but in production.

I want my user to be created on the auth emulator, so that it can trigger auth functions in my functions/index.js

For example:

exports.userCreated = functions.auth.user().onCreate(user => {
    // creates a firestore document in users collection
    return admin.firestore().collection('users').doc(user.uid).set({
        email: user.displayName
    });
});

There does not seem to be anything about connecting Node.js Firebase SDK to the auth emulator (admin.auth().useEmulator() is not defined).

How do I go about instructing a Node Admin SDK to use local auth emulator?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I followed @Vazgen answer, and I can confirm that update the firebase-admin to the latest version can fix it, version 9.9.0 as of this writing.

npm install firebase-admin@latest
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