gpt4 book ai didi

android - 如何在 react-native-firebase 中获取 firebase auth signInWithPhoneNumber 的验证回调?

转载 作者:行者123 更新时间:2023-11-29 23:20:35 24 4
gpt4 key购买 nike

我正在我的 react-native 应用程序中试用 firebase auth signInWithPhoneNumber。正在关注https://rnfirebase.io/docs/master/auth/phone-auth .然而在

firebase.auth().signInWithPhoneNumber(phoneNumber)
.then(confirmResult => {
console.log(confirmResult)
}).catch(error => {
console.log(error)
});

confirmResults 没有确认方法。

ConfirmationResult {_auth: Auth {_app: App, _customUrlOrRegion: undefined, namespace: "auth", _user: null, _settings: null, …}
_verificationId: "AM5PThBgtChKnxaZPAnPE_9zR_4qd1p2YchqZLNexlWtTiBxkUhEoOd79z0oujNP9pYrs9rgUbTsluCnlsqFjJCdbv83d89vg9LhZXJWbsnTB6w8lmxn00OqVe8S_Qc3Pfnw2qHMgZzV"
verificationId: (...)
__proto__: Object

我做错了什么?

最佳答案

看起来你做的一切都是对的。控制台输出显示您正在接收 ConfirmationResult 类的实例。

当您在类的实例上执行 console.log() 时,不会显示该类的方法。

如果您将该实例存储在一个变量中,然后对该存储的类实例调用 confirmationResult.confirm(),将调用 confirm 方法并验证提供给 confirm() 的代码。

参见 RNFirebase Phone Auth Docs对于 ConfirmationResult 以获取有关此类的更多详细信息。

关于android - 如何在 react-native-firebase 中获取 firebase auth signInWithPhoneNumber 的验证回调?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54390297/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com