简体   繁体   中英

React Native firebase email verification user.user.sendEmailVerification is not a function

i'm trying to create an app using firebase. here my code:

const user = await createUserWithEmailAndPassword(auth, email, password)
await user.user.sendEmailVerification()

user is initializing in firebase authentication but this is happening:

TypeError: user.user.sendEmailVerification is not a function.

since firebase 9:

auth =getAuth();
createUserWithEmailAndPassword(auth,email,password)
        .then(userCredential=>userCredential.user)
        .then(user=>{sendEmailVerification(user)})

You can use async-await syntax with try-catch this way:

 try { const { user } = await auth().createUserWithEmailAndPassword(email, password); await user.sendEmailVerification(); return user; } catch(e) { return e; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM