I'm having some difficulties implementing the native google and facebook login in an ionic3 application. The issues I get are the following in my console:
main.js:71 16
main.js:84 {errorMessage: "Facebook error: SERVER_ERROR: [code] 1675030
[message]: Erro ao realizar consulta. [extra]: null"}
2main.js:71 16
My functions are as follows:
signInWithGoogle() {
this.authService.signInWithGoogle()
.then(() => {
this.toastCtrl.create({ duration: 3000, position: 'bottom', message:
'Voce logou com o Google, Parabéns!' })
.present();
})
.catch((error) => {
console.log(error);
this.toastCtrl.create({ duration: 3000, position: 'bottom', message:
'Erro ao efetuar o login' })
.present();
});
}
signInWithFacebook() {
this.authService.signInWithFacebook()
.then(() => {
this.toastCtrl.create({ duration: 3000, position: 'bottom', message:
'Voce logou com o Facebook, Parabéns!' })
.present();
})
.catch((error) => {
console.log(error);
this.toastCtrl.create({ duration: 3000, position: 'bottom', message:
'Erro ao efetuar o login' })
.present();
});
}
my authentication service:
signInWithGoogle() {
return this.googlePlus.login({
'webClientId': '427145463587
9035jdo9sji99pnn8g5sve4j6ulskd2b.apps.googleusercontent.com',
'offline': true
})
.then(res => {
return this.angularFireAuth.auth.signInWithCredential
(firebase.auth.GoogleAuthProvider
.credential(res.idToken))
.then((user: firebase.User) => {
// atualizando o profile do usuario
return user.updateProfile({ displayName: res.displayName, photoURL:
res.imageUrl });
});
});
}
signInWithFacebook() {
return this.facebook.login(['public_profile', 'email'])
.then((res: FacebookLoginResponse) => {
//https://developers.facebook.com/docs/graph-api/reference/user
//Ao logar com o facebook o profile do usuario é automaticamente
atualizado.
return this.angularFireAuth.auth.signInWithCredential
(firebase.auth.FacebookAuthProvider
.credential(res.authResponse.accessToken));
});
}