【问题标题】:ERROR_APP_NOT_AUTHORIZED Firebase Phonenumber authentication in Ionic AppIonic App 中的 ERROR_APP_NOT_AUTHORIZED Firebase Phonenumber 身份验证
【发布时间】:2018-06-09 06:01:08
【问题描述】:

我遇到了错误

unknown error verifying number Error instance: com.google.firebase.auth.FirebaseAuthException Error code: ERROR_APP_NOT_AUTHORIZED

在尝试使用 firebase 在我的 ionic 应用中发送 otp 时。

this.firebase.verifyPhoneNumber(this.mobileNumber, 60)
  .then((creds) => {
    console.log(creds);
    this.verificationId=creds.verificationId;
  },(err)=>{
    console.log(err);
  })

没有发现任何提及此特定错误的信息,据我所知,我确实遵循了所有正确的步骤。我遵循了以下步骤

  1. 使用我的密钥库获取了我的 sha1 字符串
  2. 在 Firebase 控制台中创建项目并添加应用
  3. 在我的根文件夹中添加了google-services.json,并在我的主模块中复制了网络应用所需的配置脚本。
  4. 已安装@ionic-native/firebasefirebase

无法了解此错误背后的原因,当我使用 cordova run android 在我的手机中检查时出现此错误。 谢谢

更新


我对angularfire2 进行了同样的检查,并且它按预期工作。
  1. 在我的模块中

import { AngularFireModule } from 'angularfire2'; import { AngularFireAuthModule } from 'angularfire2/auth'; 和进口

imports:[
  AngularFireModule.initializeApp(firebaseConfig),
  AngularFireAuthModule
]
  1. 在我的组件中

import { AngularFireAuth } from 'angularfire2/auth';

//构造函数

  constructor(private afAuth: AngularFireAuth) {}

  onOtpSend() {
    this.afAuth.auth
      .signInWithPhoneNumber(this.mobileNumber, new firebase.auth.RecaptchaVerifier
        (
        're-container', {
          "size": 'invisible'
        }))
      .then((creds) => {
        console.log(creds);
        this.verificationId = creds.verificationId;
      })
      .catch(err => console.log(err));
  }

在我的组件 html 中也添加了 <div id='re-container'></div>

【问题讨论】:

    标签: angular firebase ionic2 firebase-authentication


    【解决方案1】:

    此特定错误是由于使用未签名调试 apk 进行检查所致。

    签名后按预期工作..

    【讨论】:

    • 您是否使用 debug.keystore 为您的应用签名?
    猜你喜欢
    • 1970-01-01
    • 2018-09-10
    • 2019-02-21
    • 2017-08-13
    • 2016-10-05
    • 2020-04-25
    • 2021-10-31
    • 2016-07-09
    • 1970-01-01
    相关资源
    最近更新 更多