Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

create custom objects for user in firebase

everytime user is signing up, create a firestore doc about that user 

async function signUp(email, password) {
  // This function returns a credential which gives you the user's uid
  // which you could then use to create your document
  const credential = await createUserWithEmailAndPassword(auth, email, password);

  const uid = credential.user.uid

  // Create a new document using the uid as the document id
  // or however else you want to use this
  const ref = firebase.auth().collection("users").doc(uid)
  await ref.set({
    email,
    uid
  })
}

CODE BY "I'm Joe Too" from StackOverflow https://stackoverflow.com/questions/69547341/creating-a-document-every-time-someone-signs-up-in-firebase
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #create #custom #objects #user #firebase
ADD COMMENT
Topic
Name
3+8 =