mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Merged PR 1983: fix(auth): prevent duplicate login popup on slow networks during QR code login
fix(auth): prevent duplicate login popup on slow networks during QR code login This commit fixes issue #5367 where the login popup appeared twice on iPad (and other devices) during QR code authentication when using slow network connections (e.g., Fast 4G). Root Cause: During the QR code login flow on slow networks, there was a race condition: 1. User scans QR code and login flow initiates 2. Before SSO redirect completes, HTTP requests (e.g., user storage) fail with 401 3. HTTP error interceptor caught these 401s and triggered another login popup Changes: 1. HTTP Error Interceptor (http-error.interceptor.ts): - Now checks if auth is initialized before handling 401 errors - Only triggers login flow after authentication initialization completes - Prevents duplicate login popups during initial authentication 2. User Storage Provider (user.storage-provider.ts): - Waits for authentication to complete before loading user state - Uses authenticated$ observable to ensure user is logged in - Prevents unnecessary 401 errors during login flow - Added structured logging for better debugging 3. Auth Service (auth.service.ts): - Added authenticated$ observable to track authentication state - Enhanced logging throughout authentication lifecycle - Better state management for authentication status 4. App Module (app.module.ts): - Added comprehensive logging for initialization steps - Store subscription now waits for auth to be initialized - Better error handling and status reporting 5. Storage Tokens (tokens.ts): - USER_SUB token now properly reacts to authentication changes - Uses authenticated$ observable for reactive updates Result: - No more duplicate login popups on slow networks - User storage only loads when user is authenticated - Better logging and debugging capabilities - Cleaner, more reactive authentication flow Related work items: #5367
This commit is contained in:
committed by
Nino Righi
parent
88cb32ef1b
commit
0a5b1dac71
76154
package-lock.json
generated
76154
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user