【问题标题】:Firebase SMS VerificationFirebase 短信验证
【发布时间】:2021-01-21 07:36:41
【问题描述】:

我正在为我的颤振应用程序使用 Firebase 身份验证。我为这个代码配置了firebase并开始使用

      login() async {
        await FirebaseAuth.instance
        .verifyPhoneNumber(
          phoneNumber: '+447123123456',
          verificationCompleted: (PhoneAuthCredential credential) {},
          verificationFailed: (FirebaseAuthException e) {
            print("Code  Failed 2");
            print(e);
          },
          codeSent: (String verificationId, int resendToken) {
            print("Code Send");
          },
          codeAutoRetrievalTimeout: (String verificationId) {},
        )
      );
    }

当我执行这段代码时,它会打印出来

    I/BiChannelGoogleApi(13432): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: 
    com.google.firebase.auth.api.internal.zzaq@3665a442
    I/flutter (13432): Code  Failed 2
    I/flutter (13432): [firebase_auth/null] null

无法跟踪错误消息并且验证码未发送到我的设备我使用此链接作为参考https://firebase.flutter.dev/docs/auth/phone/

【问题讨论】:

  • 你用的是安卓还是IOS?
  • 目前是安卓
  • 尝试 +44 7123 123 456 使用空格

标签: firebase flutter firebase-authentication one-time-password


【解决方案1】:

它无法正常工作的几个可能原因可能是-

  1. 您可能没有在 Firebase 控制台中启用短信验证身份验证。
  2. 在测试时检查您是否在模拟器或实际设备中连接到互联网。
  3. 其他可能的原因可能是模拟器的 android 图像。尝试在其他一些支持 google play 服务的现代图像中进行测试。

【讨论】:

    猜你喜欢
    • 2016-08-10
    • 2018-03-17
    • 2020-05-11
    • 2020-12-06
    • 2018-05-09
    • 2016-07-27
    • 1970-01-01
    • 1970-01-01
    • 2019-09-05
    相关资源
    最近更新 更多