我是 Angular 的新手,目前正在实施 Google 登录(OAuth)。每当我使用 Google 进行身份验证时,都会遇到此问题。分享我的登录和注销功能。当前使用 Angular 社交登录,即 Google 登录。
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) => {
});
}