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

430
Vistas
Firebase/javascript -- How to connect data created in firestore with user

Firebase v9

How to connect data created in firestore with user who created this data?

I use the createUserWithEmailAndPassword function to authorize user in firebase and after authorization I getting user data with onAuthStateChanged, but how could i connect particular user with data that is created only by them?

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

0

To create for example a profile document for a specific user, the common pattern is to use the user's UID as the document ID. Something like this:

import { getAuth, onAuthStateChanged } from "firebase/auth";
import { doc, setDoc } from "firebase/firestore"; 

const auth = getAuth();
onAuthStateChanged(auth, (user) => {
  if (user) {
    const uid = user.uid;

    await setDoc(doc(db, "users", uid), {
      name: user.displayName
    });
    // ...
  }
});

Also see:

  • the Firebase documentation on getting the current user
  • the Firebase documentation on writing a document
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