如何解决带有 Google 登录的 Ionic Angular android 应用程序仅适用于网络部署
我来这里是为了向您展示我在使用 Cordova 制作的 Angular Android 应用程序中使用 Google 插件登录时遇到的一个问题!
让插件 codetrix-studio/capacitor-google-auth 工作是一个棘手的配置。最后,我找到了解决方案,并在我的 localhost:8100 授权后构建了离子应用程序并在我的浏览器上对其进行了测试。我打印了输出数据,这里是:
然后为了检查登录是否真的有效,我运行了以下命令:“ionic cap copy”然后是“ionic cap sync”。然后使用“ionic cap open android”启动,在选择我想登录的帐户后出现此错误:
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 举报,一经查实,本站将立刻删除。