diff --git a/frontend/src/app/feature/auth/oauth2/oauth2-callback.component.ts b/frontend/src/app/feature/auth/oauth2/oauth2-callback.component.ts index d07320a..62a5772 100644 --- a/frontend/src/app/feature/auth/oauth2/oauth2-callback.component.ts +++ b/frontend/src/app/feature/auth/oauth2/oauth2-callback.component.ts @@ -29,17 +29,14 @@ export class OAuth2CallbackComponent implements OnInit { ) {} ngOnInit(): void { - // Check for code in URL params this.route.queryParams.subscribe((params) => { const code = params['code']; const provider = this.route.snapshot.data['provider'] || 'github'; if (code) { if (provider === 'google') { - // Exchange Google code for a JWT token this.authService.googleAuth(code).subscribe({ next: () => { - // Redirect to home after successful authentication this.router.navigate(['/home']); }, error: (err) => { @@ -47,17 +44,14 @@ export class OAuth2CallbackComponent implements OnInit { this.error = err.error?.message || 'Authentication failed. Please try again.'; console.log('Error details:', err); - // Redirect back to landing page after showing error setTimeout(() => { this.router.navigate(['/']); }, 3000); }, }); } else { - // Exchange GitHub code for a JWT token this.authService.githubAuth(code).subscribe({ next: () => { - // Redirect to home after successful authentication this.router.navigate(['/home']); }, error: (err) => { @@ -65,7 +59,6 @@ export class OAuth2CallbackComponent implements OnInit { this.error = err.error?.message || 'Authentication failed. Please try again.'; console.log('Error details:', err); - // Redirect back to landing page after showing error setTimeout(() => { this.router.navigate(['/']); }, 3000); @@ -75,7 +68,6 @@ export class OAuth2CallbackComponent implements OnInit { } else { this.error = 'Authentication failed. No authorization code received.'; - // Redirect back to landing page after showing error setTimeout(() => { this.router.navigate(['/']); }, 3000);