带有 Google 登录的 Ionic Angular android 应用程序仅适用于网络部署

问题描述

我来这里是为了向您展示我在使用 Cordova 制作的 Angular Android 应用程序中使用 Google 插件登录时遇到的一个问题!

插件 codetrix-studio/capacitor-google-auth 工作是一个棘手的配置。最后,我找到了解决方案,并在我的 localhost:8100 授权后构建了离子应用程序并在我的浏览器上对其进行了测试。我打印了输出数据,这里是:

login success

然后为了检查登录是否真的有效,我运行了以下命令:“ionic cap copy”然后是“ionic cap sync”。然后使用“ionic cap open android”启动,在选择我想登录的帐户后出现此错误

error

 async doGoogleLogin(){
    this.userInfo="Started";
    let googleUser = null;
    try{
      googleUser= await Plugins.GoogleAuth.signIn();
    }catch(err){
      this.error = err;
    }

    if(googleUser!= null){
      console.log(googleUser)
      this.userInfo = "! LOGGED AS : " + googleUser.email + "\n" 
                       +googleUser.authentication.accesstoken + " " + googleUser.serverAuthCode;
    }else{
      this.userInfo = "null";
      googleUser= await Plugins.GoogleAuth.signIn().catch(x => {
        this.userInfo = x;
      });
    }

  }

这是我调用登录方法代码。我不知道具体是什么错误,可能是一些配置错误。如果您需要额外的代码或一些额外的细节,我很乐意为您提供。

提前谢谢你♥

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)