I'm new to angular, currently implementing Google Sign-In(OAuth). I'm encountering this issue whenever I'm authenticating with Google. Sharing my login and logout functionality. Currently using Angular Social Login i.e Google Login.
signInWithGoogle(): void {
this.authService.signIn(GoogleLoginProvider.PROVIDER_ID).then((data) => {
console.log(data);
}).catch(data => {
this.authService.signOut();
this.router.navigate(['login']);
});
signOut(): void {
this.authService.signOut().then((data) => {
this.router.navigate(['login']);
}).catch((data) => {
});
}
This worked for me.
Refer: https://www.npmjs.com/package/angularx-social-login