【发布时间】:2020-01-28 07:14:47
【问题描述】:
verify = async () => {
this.isProcessing = true
this.isRegistering = true
const phoneNumber = `${this.currentUser.phoneDialCode}${this.currentUser.phoneNumber}`
// Get reference to the currently signed-in user
this.prevUser = firebase.auth().currentUser
console.log('prev user', this.prevUser)
await firebase.auth().signInWithPhoneNumber(phoneNumber)
.then(async (results) => {
this.isProcessing = false
this.verificationCode = results
console.log('=================================')
console.log('RESULTS', this.verificationCode)
console.log('=================================')
if (!this.verificationCode.verificationId) {
this.triggerAlert(
'Error',
'Phone number might have been blocked because of too much use.',
() => true,
)
await firebase.auth().verifyPhoneNumber(phoneNumber).then((res) => {
console.log('ver phon', res)
})
}
console.log('=================================')
console.log('Current User', firebase.auth().currentUser)
console.log('=================================')
}).catch((error) => {
this.isProcessing = false
this.loginOldUser()
// this.prevUser = new User()
this.triggerAlert(
'Error',
'Phone number format might not be correct. Please check again.',
() => true,
)
this.isPhoneVerified = false
this.currentUser.phoneFlag = ''
this.currentUser.phoneCode = ''
this.currentUser.phoneDialCode = ''
this.currentUser.phoneNumber = ''
})
}
因此,由于某种原因,多次使用我的电话号码后,它不再返回正确的值,只返回 null。我已经有一段时间没有使用它们了,所以我不确定出了什么问题。我正在尝试测试重新发送代码,这就是我不使用白名单号码的原因。
我添加了验证电话号码只是为了看看它是否可以更深入地了解我的问题。
对这些有什么想法吗?谢谢!
【问题讨论】:
标签: javascript firebase react-native firebase-authentication react-native-firebase