Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

273
Vistas
How do I receive the context parameter in the a cloud function onCall?

I have a cloud function that is called by my front-side app in React Native. Here is my cloud function:

exports.listProducts = functions.https.onCall((temp, context) => {
  console.log("fired");
  return context;
});

And here is how I call the function:

    let temp = await functions().httpsCallable("listProducts")(
      null,
      firebase.auth().currentUser
    );

However, I can't acccess the context variable in my cloud function which according to docs should be the Firebase auth. And the console.log in that function does not give me a log.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Any parameters you pass to the callable function are available in the first parameter, which you call temp, but that the Firebase documentation refers to as data.

You don't need to pass the current user to the callable function yourself, as the Firebase SDK already handles that for you, and the server already decoded the current user into context.auth.

For more on both parameters and the auth context, have a look at the Firebase documentation on writing and deploying callable functions, which contains:

Use functions.https.onCall to create an HTTPS callable function. This method takes two parameters: data, and optional context:

// Saves a message to the Firebase Realtime Database but sanitizes the text by removing swearwords.
exports.addMessage = functions.https.onCall((data, context) => {
 // ...
});

For a callable function that saves a text message to the Realtime Database, for example, data could contain the message text, while context parameters represent user auth information:

// Message text passed from the client.
const text = data.text;
// Authentication / user information is automatically added to the request.
const uid = context.auth.uid;
const name = context.auth.token.name || null;
const picture = context.auth.token.picture || null;
const email = context.auth.token.email || null;
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda