【发布时间】:2018-11-26 16:18:19
【问题描述】:
在我尝试实现通知之前,我的应用程序运行良好,在 android 设备上运行时出现 firebase 拒绝连接和 404 错误,但在浏览器上一切正常。然后重新安装了每个插件和模块,解决了firebase连接的问题,但谷歌原生登录方法根本不起作用,甚至没有抛出任何错误
signInWithGoogle() {
if (this.platform.is('cordova')) {
this.nativeGoogleLogin();
}else{
this.webGoogleLogin().then(()=>{});
}
}
async nativeGoogleLogin(): Promise<void>{
try {
this.loading.present();
const gplusUser = await this.gplus.login({
'webClientId':'******',
'offline':true,
'scopes':'profile email'
})
console.log('NativeLogin');
return await this.afAuth.auth.signInWithCredential(
firebase.auth.GoogleAuthProvider.credential(gplusUser.idToken))
// return await this.afAuth.auth.signInAndRetrieveDataWithCredential(
// firebase.auth.GoogleAuthProvider.credential(gplusUser.idToken))
.then(data =>{
this.loading.dismiss();
console.log(data);
this.updateUserData(data.user);
}).catch(err =>{
this.loading.dismiss();
console.log('NativeLoginError',err);
})
} catch (error) {
this.loading.dismiss();
console.error('NativeLoginError',error);
}
}
异步方法甚至不是控制台记录文本。
console.log('NativeLogin');
我仔细检查了 webClientId。正在努力解决这个问题
【问题讨论】:
-
你的 cordova android 版本是多少?
-
@fahadsk Cordova android 7.1.0 出现 androidManifist.xml 错误,因此降级为 cordova-android: 6.4.0
-
你检查过降级到 6.3.0 吗?
-
是的,刚刚检查过,降级到 6.3.0 后它没有立即工作,在我删除 native-firebase 插件后它工作。我想知道问题是否是由于 native-firebase 插件本身。感谢您的帮助
标签: android firebase ionic3 angularfire2 ionic-native