React Native Firebase电话身份验证在合法电话号码上的空值

问题描述 投票:0回答:1
    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 = ''
      })
  }

日志:Logs

因此,由于某些原因,在多次使用我的电话号码后,它不再返回仅空值的正确值。我已经有一段时间没有使用它们了,所以我不确定是怎么回事。我正在尝试重新发送代码,这就是为什么我不使用白名单中的数字。

我添加了验证电话号码只是为了看看它可以为我的问题提供更多的见识。

对此有何想法?谢谢!

javascript firebase react-native firebase-authentication react-native-firebase
1个回答
0
投票

因为您说:

© www.soinside.com 2019 - 2024. All rights reserved.