【问题标题】:React Native Firebase Phone Authentication null values on legit phone number在合法电话号码上反应本机 Firebase 电话身份验证空值
【发布时间】: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


    【解决方案1】:

    既然你说:

    多次使用我的电话号码后,它不再返回正确的值,只返回 null

    我的第一个想法是你被限制了。

    来自 sending a verification code to the user's phone 上的 Firebase 文档:

    为防止滥用,Firebase 对在一段时间内可以发送到单个电话号码的 SMS 消息数量实施了限制。如果超出此限制,电话号码验证请求可能会受到限制。如果您在开发过程中遇到此问题,请使用其他电话号码进行测试,或稍后重试请求。

    【讨论】:

    • 我在周末没有使用我的号码。从上周开始也是这样。我使用了我的其他电话号码和他们上周工作的同事的电话号码,但本周他们似乎也被屏蔽了。奇怪的是,即使 firebase 返回 null 值,它们也会显示在 firebase 的身份验证选项卡中。
    • 在那种情况下,我不知道会发生什么。如果您看到项目中的任何用户都没有发送任何文本,您可能需要检查您是否仍在该项目的使用配额内。如果这也无法解释,请reach out to Firebase support 寻求个性化的故障排除帮助。
    • 如果我们使用新号码,我们仍然可以收到短信和所有内容。而且我怀疑我在短短两周内就获得了 1000 个。感谢您的链接!我没有看到他们有支持链接(我太愚蠢了)。
    猜你喜欢
    • 1970-01-01
    • 2020-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多