android - 离子谷歌登录在 android 上工作但在 IOS 上工作:有效负载观众!= requiredAudience
问题描述
我一直在使用这个插件在 ionic 中开发谷歌登录功能: https ://github.com/EddyVerbruggen/cordova-plugin-googleplus
这已经是一段痛苦的旅程。我现在可以在android上运行。我要求插件向我传递一个 idToken,但为了检索它,您需要将 webClientId 与它一起传递(如下面的代码所示)。我从 android 和 ios 中检索到该 idToken 并将其发送到后端以检查它是否是真正的令牌。现在这是我不太明白的部分。在 android 上,验证通过并登录用户,但在 ios 上,如果给我错误wrong recipient, payload audience != requiredAudience
代码完全相同,所以我不太明白这里发生了什么。有没有人对此有任何经验以及可以帮助我的插件?提前一百万谢谢。如果这可以帮助任何人,这是代码:
googleLogin() {
this.isLoggingIn = true;
this.googlePlus.login({
'webClientId': environment.webClientId
}).then(googleRes => {
this.authService.googleLogin(googleRes.idToken).subscribe(
//logic
)
}).catch(err => {
console.log(err);
this.isLoggingIn = false;
});
}
解决方案
推荐阅读
- rstudio - R笔记本全屏模式
- javascript - HowTo Google 登录 - 理解、安全 - 如何处理数据
- c++ - 在 C++ 模板函数中接收相同类型的可变参数大小的原始数组
- nuxt.js - 使用 nuxt.js 一次生成两个静态应用程序
- mysql - 查询(HAVING 子句)在 Mysql 版本 5.7 和 8.0 之间的行为不同
- amazon-cloudwatchlogs - 使用 cloudwatch 代理时如何解决“无效序列令牌”?
- keras - GridSearchCV、管道和功能模型
- python - 如何从 URL 中有日期的多个页面中提取数据?
- java - 如何在 natTable 中对配置标签进行排序?(有没有一种简单的方法可以从 nattable 中获取相对坐标?)
- javascript - 带有不跟随缩放的垂直可拖动项目符号的 AmCharts4 折线图