import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { AuthService } from '../../core/services/auth.service'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; @Component({ selector: 'app-oauth-callback', standalone: true, imports: [MatProgressSpinnerModule], template: `

Completing sign in...

`, }) export class OAuthCallbackComponent implements OnInit { constructor( private route: ActivatedRoute, private router: Router, private authService: AuthService, ) {} ngOnInit(): void { const accessToken = this.route.snapshot.queryParamMap.get('accessToken'); const refreshToken = this.route.snapshot.queryParamMap.get('refreshToken'); if (accessToken && refreshToken) { this.authService.setSessionFromOAuth(accessToken, refreshToken); this.router.navigate(['/dashboard']); } else { this.router.navigate(['/login']); } } }