使用Firebase和React Native进行SMS验证

时间:2019-08-20 12:14:22

标签: firebase react-native firebase-authentication sms-verification

我想通过Firebase在React Native中进行短信验证 我正在使用react-native-firebase库访问Firebase SDK 尽管我已经尝试过使用其内置方法来发送验证码,但无法正常工作 我使用的方法:

    firebase.auth().verifyPhoneNumber('+p #')
               .on('state_changed', (phoneAuthSnapshot) => {
           console.log(phoneAuthSnapshot)
       })
    firebase.auth().signInWithPhoneNumber('+p #')
   .then((confirmResult) => {
       console.log(confirmResult)
   })
   .catch((error)=>{
       console.log("catch"+error)
   })

我尝试了很多方法。我采用Firebase免费计划,并且也正确上传了SHA1哈希。

我收到错误

  

代码:空

     

错误:空

     

状态:“已发送”

     

verificationId:“ AM5PThB_qcB3PDSoEsEGy2fKu4kAqg-SOcrF45oz5Zx5gi8Rv3JJM94hstJJvT9XoWM2O9oqlHybMVHMt-ajH9PK-mEy2YFIMiEjEDE6N9WNKND9P9W

但代码未发送到我的巴基斯坦或美国号码。

0 个答案:

没有答案