【问题标题】:SMS Telephone number confirmation with ionic and firebase使用 ionic 和 firebase 的 SMS 电话号码确认
【发布时间】:2016-08-05 11:46:52
【问题描述】:

我正在使用 ionic 和 firebase 开发移动应用程序。我想要的是,要确认用户,他必须输入他的手机号码,接收短信,输入代码,然后才能确认。 我环顾四周,发现了一些像 twilio 这样的短信工具,但我不确定我是否可以使用它们。 最好的方法是什么?

【问题讨论】:

  • 你找到答案了吗?

标签: ionic-framework firebase sms firebase-authentication


【解决方案1】:

你看过 Authy 吗?

本帐户验证教程将引导您为您所谈论的功能设置 Node 后端。

https://www.twilio.com/docs/tutorials/walkthrough/account-verification/node/express

据我所知,您应该不会对这样的后端有任何问题,因为 ionic 会处理您的前端。

【讨论】:

【解决方案2】:
  import { Firebase } from '@ionic-native/firebase';   

  let number = "+91"+ number;     
  this.platform.ready().then(()=>{
  (<any>window).FirebasePlugin.verifyPhoneNumber(number, 120, (credential) => {
    var verificationId = credential.verificationId;
    this.navCtrl.push(VerificationPage, { verificationId: verificationId, phoneNumber: this.emailPasswordForm.value["phoneNumber"]  }); //This is STEP 3 - passing verification ID to OTP Page
  }, (error) => {
    //this.eer = error;
    alert('Failed to send OTP. Try again');
    console.error(error);
  });

首先将 sha1 设置为 firebase 设置并生成 google config.json 然后添加到 poject 的根目录并添加到 build.gradle 依赖项。 它会正常工作

【讨论】:

    猜你喜欢
    • 2023-04-07
    • 2017-11-06
    • 2018-03-03
    • 2013-12-06
    • 2018-04-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-28
    相关资源
    最近更新 更多