0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

firebaseでメールアドレスを取得する方法

Last updated at Posted at 2021-01-09

#Firebaseでユーザネームをメールアドレスを取得する方法

export const createUserProfileDocument = (userAuth. additionalData) => {
 if(!userAuth) return;
 
const userRef = firestore.doc(`users/${userAuth.uid}`)

const snapshot = await userRef.get()

if(!snapshot.exists) {
 const {displayName, email} = userAuth;
 const createdAt = new Date();

 try {
  await userRef.set({
   displayName,
   email,
   ...additionalData
  })
} catch (error){
 console.log('error creating user' error.message)
}
}
return userRef
}

間違っていたら教えてください

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?