From b80a8933ca3888b4aaee138fffe37ac714a89233 Mon Sep 17 00:00:00 2001 From: arolleaguekeng Date: Fri, 6 Feb 2026 01:24:06 +0100 Subject: [PATCH] feat: add automatic navigation to dashboard after mobile OAuth redirect authentication Add Router injection to AuthService and implement automatic navigation to /console after successful mobile OAuth redirect authentication. Add console logging to track redirect authentication flow and navigation steps in handleRedirectResult method. --- .../src/app/modules/auth/services/auth.service.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/main-dashboard/src/app/modules/auth/services/auth.service.ts b/apps/main-dashboard/src/app/modules/auth/services/auth.service.ts index ef6f3153..40f7bf0b 100644 --- a/apps/main-dashboard/src/app/modules/auth/services/auth.service.ts +++ b/apps/main-dashboard/src/app/modules/auth/services/auth.service.ts @@ -1,5 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { inject, Injectable, forwardRef } from '@angular/core'; +import { Router } from '@angular/router'; import { TokenService } from '../../../shared/services/token.service'; import { CookieService } from '../../../shared/services/cookie.service'; import { @@ -22,6 +23,7 @@ import { environment } from '../../../../environments/environment'; }) export class AuthService { private auth = inject(Auth); + private router = inject(Router); user$: Observable; private http = inject(HttpClient); private tokenService = inject(forwardRef(() => TokenService)); @@ -50,7 +52,11 @@ export class AuthService { try { const result = await getRedirectResult(this.auth); if (result?.user) { + console.log('Utilisateur authentifié via redirect, traitement du login...'); await this.postLogin(result.user); + // Rediriger vers le dashboard après une authentification réussie + console.log('Navigation vers /console après authentification mobile réussie'); + await this.router.navigate(['/console']); } } catch (error) { console.error('Erreur lors de la gestion du résultat de redirection:', error);