简体   繁体   English

React Native firebase email 验证user.user.sendEmailVerification 是不是function

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

i'm trying to create an app using firebase. here my code:我正在尝试使用 firebase 创建一个应用程序。这里是我的代码:

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

user is initializing in firebase authentication but this is happening:用户正在 firebase 身份验证中初始化,但正在发生这种情况:

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

since firebase 9:自 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:您可以通过这种方式将async-await语法与try-catch一起使用:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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