I successfully integrated Firebase Google sign-up authentication into my project, and it functions flawlessly on Google chrome. However, upon downloading the APK and testing it on my Android device, I encountered an issue. After selecting the account and proceeding, Google Chrome opens, but instead of the expected behavior, a blank page appears, and the process halts without further action.
continueWithGoogle() {
this.authService.GoogleAuth()
.then(() => {
console.log("test dfsf");
this.nav.push('tabs');
})
.catch((error) => {
console.error(error);
});
}
GoogleAuth(): Promise<any> {
return new Promise((resolve, reject) => {
this.AuthLogin(new auth.GoogleAuthProvider())
.then((result) => {
console.log(result, "dfsfsd");
resolve(result);
})
.catch((error) => {
reject(error);
});
});
}
AuthLogin(provider: any): Promise<any> {
return new Promise((resolve, reject) => {
this.ngFireAuth.signInWithPopup(provider)
.then((result) => {
console.log(result);
this.SetUserData(result.user);
resolve(result);
})
.catch((error) => {
window.alert(error.message);
reject(error);
});
});
}
SetUserData(user: any) {
const userRef: AngularFirestoreDocument<any> = this.afStore.doc(
`users/${user.uid}`
);
const userData: User = {
uid: user.uid,
email: user.email,
displayName: user.displayName,
photoURL: user.photoURL,
emailVerified: user.emailVerified,
};
return userRef.set(userData, {
merge: true,
});
}
New contributor
Hamza Shahid is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.