@opensourcekd/ng-common-libs 1.2.6 → 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -217,14 +217,16 @@ export default {
217
217
 
218
218
  ### AuthService
219
219
 
220
- - `login(options?: RedirectLoginOptions): Promise<void>` - Initiate Auth0 login
221
- - `logout(options?: LogoutOptions): Promise<void>` - Logout and clear session
222
- - `handleCallback(): Promise<{ success: boolean, appState?: any }>` - Handle Auth0 callback
223
- - `getToken(): Promise<string | null>` - Get access token asynchronously
224
- - `getTokenSync(): string | null` - Get cached access token synchronously
225
- - `getUser(): Signal<UserInfo | null>` - Get user information as signal
226
- - `isAuthenticated(): Signal<boolean>` - Check authentication status
227
- - `isLoading(): Signal<boolean>` - Check if authentication is loading
220
+ - `login(user?: string, options?: { invitation?: string; organization?: string }): Promise<void>` - Initiate Auth0 login with optional user identifier and organization invitation parameters
221
+ - `logout(): Promise<void>` - Logout and clear session
222
+ - `handleCallback(): Promise<{ success: boolean, appState?: any }>` - Handle Auth0 callback and return success status with preserved appState
223
+ - `getToken(): Promise<string | null>` - Get access token asynchronously (checks storage first, then Auth0)
224
+ - `getTokenSync(): string | null` - Get cached access token synchronously (storage only)
225
+ - `getUser(): UserInfo | null` - Get current user information
226
+ - `getUserData(): UserData | null` - Get simplified user data with role and organization extraction
227
+ - `isAuthenticated(): Promise<boolean>` - Check authentication status asynchronously (verifies with Auth0)
228
+ - `isAuthenticatedSync(): boolean` - Check authentication status synchronously (storage only)
229
+ - `user$: Observable<UserInfo | null>` - Observable stream of user changes
228
230
 
229
231
  ### EventBusService
230
232
 
@@ -205,11 +205,15 @@ function jwtDecode(token, options) {
205
205
  /**
206
206
  * Auth0 client configuration
207
207
  * Override these values in your consuming application by setting them before importing AuthService
208
+ *
209
+ * Note: redirectUri defaults to window.location.origin (base URL without path).
210
+ * Auth0 will redirect back to this URL after authentication.
211
+ * You can override this to a specific callback URL (e.g., '/auth-callback') using configureAuth0().
208
212
  */
209
213
  const AUTH0_CONFIG = {
210
214
  domain: '', // Set in consuming app: process.env['NX_AUTH0_DOMAIN'] || 'your-domain.auth0.com'
211
215
  clientId: '', // Set in consuming app: process.env['NX_AUTH0_CLIENT_ID'] || 'your-client-id'
212
- redirectUri: typeof window !== 'undefined' ? window.location.origin + '/auth-callback' : '',
216
+ redirectUri: typeof window !== 'undefined' ? window.location.origin : '',
213
217
  logoutUri: typeof window !== 'undefined' ? window.location.origin : '',
214
218
  audience: '', // Optional: Set in consuming app if using API authorization
215
219
  scope: 'openid profile email', // Default scopes
@@ -270,22 +274,55 @@ function removeStorageItem(key, storageType = 'sessionStorage') {
270
274
  storage.removeItem(key);
271
275
  }
272
276
  /**
273
- * Configure Auth0 settings
274
- * Call this function in your consuming application before using AuthService
277
+ * Configure Auth0 settings (OPTIONAL)
278
+ * Call this function in your consuming application to override default Auth0 configuration.
279
+ * Only the values you provide will be overridden; all other defaults remain unchanged.
280
+ *
281
+ * Note: This function is optional. If not called, default values will be used.
282
+ *
283
+ * @param config - Partial Auth0 configuration object with values to override
275
284
  *
276
285
  * @example
277
286
  * ```typescript
278
287
  * import { configureAuth0 } from '@opensourcekd/ng-common-libs';
279
288
  *
289
+ * // Only override specific values - others keep their defaults
280
290
  * configureAuth0({
281
291
  * domain: 'your-domain.auth0.com',
282
292
  * clientId: 'your-client-id',
283
293
  * audience: 'https://your-api.com'
294
+ * // redirectUri, logoutUri, scope, etc. will use defaults
295
+ * });
296
+ *
297
+ * // Or override just redirectUri to use a specific callback page
298
+ * configureAuth0({
299
+ * redirectUri: window.location.origin + '/auth-callback'
284
300
  * });
285
301
  * ```
286
302
  */
287
303
  function configureAuth0(config) {
304
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
305
+ console.log('[AuthConfig] 🔍 DEBUG: configureAuth0() called with config:', {
306
+ domain: config.domain || 'not provided',
307
+ clientId: config.clientId ? '[REDACTED]' : 'not provided',
308
+ redirectUri: config.redirectUri || 'not provided',
309
+ logoutUri: config.logoutUri || 'not provided',
310
+ audience: config.audience || 'not provided',
311
+ scope: config.scope || 'not provided',
312
+ connection: config.connection || 'not provided'
313
+ });
314
+ // Only override provided values, keeping defaults for others
288
315
  Object.assign(AUTH0_CONFIG, config);
316
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
317
+ console.log('[AuthConfig] 🔍 DEBUG: AUTH0_CONFIG after merge:', {
318
+ domain: AUTH0_CONFIG.domain,
319
+ clientId: AUTH0_CONFIG.clientId ? '[REDACTED]' : undefined,
320
+ redirectUri: AUTH0_CONFIG.redirectUri,
321
+ logoutUri: AUTH0_CONFIG.logoutUri,
322
+ audience: AUTH0_CONFIG.audience || 'not set',
323
+ scope: AUTH0_CONFIG.scope,
324
+ connection: AUTH0_CONFIG.connection || 'not set'
325
+ });
289
326
  }
290
327
 
291
328
  /**
@@ -314,6 +351,8 @@ exports.AuthService = class AuthService {
314
351
  constructor(eventBus) {
315
352
  this.eventBus = eventBus;
316
353
  console.log("[AuthService] Initializing Auth0 authentication service");
354
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
355
+ console.log('[AuthService] 🔍 DEBUG: Constructor called, starting initialization');
317
356
  this.initializationPromise = this.initializeAuth0();
318
357
  }
319
358
  /**
@@ -322,13 +361,30 @@ exports.AuthService = class AuthService {
322
361
  async initializeAuth0() {
323
362
  try {
324
363
  console.log("[AuthService] Starting Auth0 client initialization...");
364
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
365
+ console.log('[AuthService] 🔍 DEBUG: initializeAuth0 called');
325
366
  // Defensive check for AUTH0_CONFIG
326
367
  if (!AUTH0_CONFIG || typeof AUTH0_CONFIG !== 'object') {
368
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
369
+ console.error('[AuthService] 🔍 DEBUG: AUTH0_CONFIG validation failed - invalid or undefined');
327
370
  throw new Error('[AuthService] AUTH0_CONFIG is not defined or invalid');
328
371
  }
329
372
  if (!AUTH0_CONFIG.domain || !AUTH0_CONFIG.clientId) {
373
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
374
+ console.error('[AuthService] 🔍 DEBUG: AUTH0_CONFIG validation failed - missing domain or clientId', {
375
+ domain: AUTH0_CONFIG.domain,
376
+ clientId: AUTH0_CONFIG.clientId ? '[REDACTED]' : undefined
377
+ });
330
378
  throw new Error('[AuthService] AUTH0_CONFIG is missing required fields (domain, clientId)');
331
379
  }
380
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
381
+ console.log('[AuthService] 🔍 DEBUG: Creating Auth0 client with config:', {
382
+ domain: AUTH0_CONFIG.domain,
383
+ clientId: AUTH0_CONFIG.clientId ? '[REDACTED]' : undefined,
384
+ redirectUri: AUTH0_CONFIG.redirectUri,
385
+ scope: AUTH0_CONFIG.scope,
386
+ audience: AUTH0_CONFIG.audience || 'not set'
387
+ });
332
388
  this.auth0Client = await oa({
333
389
  domain: AUTH0_CONFIG.domain,
334
390
  clientId: AUTH0_CONFIG.clientId,
@@ -341,9 +397,13 @@ exports.AuthService = class AuthService {
341
397
  useRefreshTokens: true, // Enable refresh tokens for better security
342
398
  });
343
399
  console.log("[AuthService] Auth0 client initialized successfully");
400
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
401
+ console.log('[AuthService] 🔍 DEBUG: Auth0 client created successfully');
344
402
  }
345
403
  catch (error) {
346
404
  console.error("[AuthService] Failed to initialize Auth0 client:", error);
405
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
406
+ console.error('[AuthService] 🔍 DEBUG: initializeAuth0 failed with error:', error);
347
407
  throw error;
348
408
  }
349
409
  }
@@ -365,21 +425,24 @@ exports.AuthService = class AuthService {
365
425
  * @param options - Optional login options including invitation and organization parameters
366
426
  */
367
427
  async login(user, options) {
428
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
429
+ console.log('[AuthService] 🔍 DEBUG: login() called', { user, options });
368
430
  if (user) {
369
431
  console.log(`[AuthService] Logging in: ${user}`);
370
432
  }
371
433
  try {
372
434
  // Ensure Auth0 client is initialized
373
435
  await this.ensureInitialized();
436
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
437
+ console.log('[AuthService] 🔍 DEBUG: Auth0 client ensured initialized for login');
374
438
  // Capture current URL search parameters to preserve through auth flow
375
- // Only capture if we're not already on the callback page
376
- const currentPath = window.location.pathname;
377
- const isCallbackPage = currentPath.includes('auth-callback');
378
439
  let appState = undefined;
379
- if (!isCallbackPage && window.location.search) {
440
+ if (window.location.search) {
380
441
  const currentSearchParams = window.location.search;
381
442
  appState = { returnTo: currentSearchParams };
382
443
  console.log('[AuthService] Preserving URL parameters through auth flow:', currentSearchParams);
444
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
445
+ console.log('[AuthService] 🔍 DEBUG: Captured URL search params for preservation:', currentSearchParams);
383
446
  }
384
447
  // Build authorization parameters
385
448
  const authorizationParams = {
@@ -397,14 +460,30 @@ exports.AuthService = class AuthService {
397
460
  authorizationParams.organization = options.organization;
398
461
  console.log('[AuthService] Including organization parameter:', options.organization);
399
462
  }
463
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
464
+ console.log('[AuthService] 🔍 DEBUG: Authorization params prepared:', {
465
+ redirect_uri: authorizationParams.redirect_uri,
466
+ scope: authorizationParams.scope,
467
+ audience: authorizationParams.audience || 'not set',
468
+ connection: authorizationParams.connection || 'not set',
469
+ invitation: authorizationParams.invitation || 'not set',
470
+ organization: authorizationParams.organization || 'not set',
471
+ hasAppState: !!appState
472
+ });
400
473
  console.log('[AuthService] Starting Auth0 login redirect...');
474
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
475
+ console.log('[AuthService] 🔍 DEBUG: About to call loginWithRedirect');
401
476
  await this.auth0Client.loginWithRedirect({
402
477
  authorizationParams,
403
478
  ...(appState && { appState })
404
479
  });
480
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
481
+ console.log('[AuthService] 🔍 DEBUG: loginWithRedirect completed (this may not be visible due to redirect)');
405
482
  }
406
483
  catch (error) {
407
484
  console.error("[AuthService] Login failed:", error);
485
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
486
+ console.error('[AuthService] 🔍 DEBUG: login() failed with error:', error);
408
487
  // Emit login failure event
409
488
  this.emitAuthEvent('login_failure', { error: error instanceof Error ? error.message : String(error) });
410
489
  throw error; // Re-throw to allow caller to handle
@@ -422,11 +501,19 @@ exports.AuthService = class AuthService {
422
501
  async handleCallback() {
423
502
  try {
424
503
  console.log("[AuthService] Processing Auth0 callback...");
504
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
505
+ console.log('[AuthService] 🔍 DEBUG: handleCallback() called');
506
+ console.log('[AuthService] 🔍 DEBUG: Current URL:', window.location.href);
507
+ console.log('[AuthService] 🔍 DEBUG: URL params:', window.location.search);
425
508
  // Ensure Auth0 client is initialized
426
509
  await this.ensureInitialized();
510
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
511
+ console.log('[AuthService] 🔍 DEBUG: Auth0 client ensured initialized for callback');
427
512
  // Process the callback
428
513
  const result = await this.auth0Client.handleRedirectCallback();
429
514
  console.log("[AuthService] Callback processed successfully");
515
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
516
+ console.log('[AuthService] 🔍 DEBUG: handleRedirectCallback result:', result);
430
517
  // Log preserved appState if present
431
518
  if (result.appState) {
432
519
  console.log('[AuthService] Restored appState from auth flow:', JSON.stringify(result.appState));
@@ -435,23 +522,35 @@ exports.AuthService = class AuthService {
435
522
  console.log('[AuthService] No appState restored (user may not have started from invitation link)');
436
523
  }
437
524
  // Get user info
525
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
526
+ console.log('[AuthService] 🔍 DEBUG: Fetching user info from Auth0');
438
527
  const user = await this.auth0Client.getUser();
439
528
  if (user) {
529
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
530
+ console.log('[AuthService] 🔍 DEBUG: User info retrieved successfully');
440
531
  this.logUserClaims(user);
441
532
  this.setUserInfo(user);
442
533
  }
443
534
  else {
444
535
  console.warn('[AuthService] No user info returned from Auth0');
536
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
537
+ console.warn('[AuthService] 🔍 DEBUG: getUser() returned null or undefined');
445
538
  // Emit login failure event
446
539
  this.emitAuthEvent('login_failure', { error: 'No user info returned from Auth0' });
447
540
  return { success: false };
448
541
  }
449
542
  // Get and store access token
543
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
544
+ console.log('[AuthService] 🔍 DEBUG: Fetching access token');
450
545
  const token = await this.auth0Client.getTokenSilently();
546
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
547
+ console.log('[AuthService] 🔍 DEBUG: Access token retrieved, length:', token?.length || 0);
451
548
  this.setToken(token);
452
549
  // Decode and print the token to console
453
550
  this.decodeAndLogToken(token);
454
551
  console.log("[AuthService] Authentication successful");
552
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
553
+ console.log('[AuthService] 🔍 DEBUG: handleCallback() completed successfully');
455
554
  // Emit login success event
456
555
  this.emitAuthEvent('login_success', { user, appState: result.appState });
457
556
  return { success: true, appState: result.appState };
@@ -459,6 +558,10 @@ exports.AuthService = class AuthService {
459
558
  catch (error) {
460
559
  console.error("[AuthService] Error processing callback:", error);
461
560
  console.error("[AuthService] Error details:", JSON.stringify(error, null, 2));
561
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
562
+ console.error('[AuthService] 🔍 DEBUG: handleCallback() failed with error:', error);
563
+ console.error('[AuthService] 🔍 DEBUG: Error type:', typeof error);
564
+ console.error('[AuthService] 🔍 DEBUG: Error stack:', error?.stack);
462
565
  // Emit login failure event
463
566
  this.emitAuthEvent('login_failure', { error: error instanceof Error ? error.message : String(error) });
464
567
  return { success: false };
@@ -565,23 +668,33 @@ exports.AuthService = class AuthService {
565
668
  * Redirects to Auth0 logout endpoint and clears local state
566
669
  */
567
670
  async logout() {
671
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
672
+ console.log('[AuthService] 🔍 DEBUG: logout() called');
568
673
  // Clear local storage
569
674
  removeStorageItem(STORAGE_KEYS.ACCESS_TOKEN, STORAGE_CONFIG.TOKEN_STORAGE);
570
675
  removeStorageItem(STORAGE_KEYS.USER_INFO, STORAGE_CONFIG.USER_INFO_STORAGE);
676
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
677
+ console.log('[AuthService] 🔍 DEBUG: Storage cleared (token and user info removed)');
571
678
  this.userSubject.next(null);
572
679
  this.emitAuthEvent('logout', null);
573
680
  console.log('[AuthService] User logged out, clearing Auth0 session');
574
681
  // Logout from Auth0
575
682
  try {
576
683
  await this.ensureInitialized();
684
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
685
+ console.log('[AuthService] 🔍 DEBUG: About to call Auth0 logout, returnTo:', AUTH0_CONFIG.logoutUri);
577
686
  await this.auth0Client.logout({
578
687
  logoutParams: {
579
688
  returnTo: AUTH0_CONFIG.logoutUri
580
689
  }
581
690
  });
691
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
692
+ console.log('[AuthService] 🔍 DEBUG: Auth0 logout completed (this may not be visible due to redirect)');
582
693
  }
583
694
  catch (error) {
584
695
  console.error('[AuthService] Error during Auth0 logout:', error);
696
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
697
+ console.error('[AuthService] 🔍 DEBUG: logout() failed with error:', error);
585
698
  }
586
699
  }
587
700
  /**
@@ -589,20 +702,30 @@ exports.AuthService = class AuthService {
589
702
  * @returns string | null - Access token or null if not authenticated
590
703
  */
591
704
  async getToken() {
705
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
706
+ console.log('[AuthService] 🔍 DEBUG: getToken() called');
592
707
  // Try to get from storage first
593
708
  const storedToken = getStorageItem(STORAGE_KEYS.ACCESS_TOKEN, STORAGE_CONFIG.TOKEN_STORAGE);
594
709
  if (storedToken) {
710
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
711
+ console.log('[AuthService] 🔍 DEBUG: Token found in storage, length:', storedToken.length);
595
712
  return storedToken;
596
713
  }
714
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
715
+ console.log('[AuthService] 🔍 DEBUG: Token not in storage, fetching from Auth0');
597
716
  // If not in storage, try to get from Auth0 client
598
717
  try {
599
718
  await this.ensureInitialized();
600
719
  const token = await this.auth0Client.getTokenSilently();
720
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
721
+ console.log('[AuthService] 🔍 DEBUG: Token retrieved from Auth0, length:', token?.length || 0);
601
722
  this.setToken(token);
602
723
  return token;
603
724
  }
604
725
  catch (error) {
605
726
  console.error('[AuthService] Error getting token from Auth0:', error);
727
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
728
+ console.error('[AuthService] 🔍 DEBUG: getToken() failed:', error);
606
729
  return null;
607
730
  }
608
731
  }
@@ -619,22 +742,34 @@ exports.AuthService = class AuthService {
619
742
  * @param token - Access token to store
620
743
  */
621
744
  setToken(token) {
745
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
746
+ console.log('[AuthService] 🔍 DEBUG: setToken() called, storing token in storage');
622
747
  setStorageItem(STORAGE_KEYS.ACCESS_TOKEN, token, STORAGE_CONFIG.TOKEN_STORAGE);
623
748
  this.emitAuthEvent('token_updated', { token });
749
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
750
+ console.log('[AuthService] 🔍 DEBUG: Token stored and token_updated event emitted');
624
751
  }
625
752
  /**
626
753
  * Check if user is authenticated
627
754
  * @returns boolean - True if user has valid token
628
755
  */
629
756
  async isAuthenticated() {
757
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
758
+ console.log('[AuthService] 🔍 DEBUG: isAuthenticated() called');
630
759
  try {
631
760
  await this.ensureInitialized();
632
- return await this.auth0Client.isAuthenticated();
761
+ const result = await this.auth0Client.isAuthenticated();
762
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
763
+ console.log('[AuthService] 🔍 DEBUG: isAuthenticated() result from Auth0:', result);
764
+ return result;
633
765
  }
634
766
  catch (error) {
635
767
  console.error('[AuthService] Error checking authentication status:', error);
636
768
  // Fallback to checking storage
637
- return !!getStorageItem(STORAGE_KEYS.ACCESS_TOKEN, STORAGE_CONFIG.TOKEN_STORAGE);
769
+ const hasToken = !!getStorageItem(STORAGE_KEYS.ACCESS_TOKEN, STORAGE_CONFIG.TOKEN_STORAGE);
770
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
771
+ console.error('[AuthService] 🔍 DEBUG: isAuthenticated() failed, falling back to storage check:', hasToken);
772
+ return hasToken;
638
773
  }
639
774
  }
640
775
  /**
@@ -714,6 +849,8 @@ exports.AuthService = class AuthService {
714
849
  * @param userInfo - User information to store
715
850
  */
716
851
  setUserInfo(userInfo) {
852
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
853
+ console.log('[AuthService] 🔍 DEBUG: setUserInfo() called');
717
854
  setStorageItem(STORAGE_KEYS.USER_INFO, JSON.stringify(userInfo), STORAGE_CONFIG.USER_INFO_STORAGE);
718
855
  this.userSubject.next(userInfo);
719
856
  // Log stored user info with all claims
@@ -732,6 +869,8 @@ exports.AuthService = class AuthService {
732
869
  console.log(` • ${claim}:`, userInfo[claim]);
733
870
  });
734
871
  }
872
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
873
+ console.log('[AuthService] 🔍 DEBUG: User info stored in storage and userSubject updated');
735
874
  this.emitAuthEvent('user_info_updated', userInfo);
736
875
  }
737
876
  /**
@@ -746,6 +885,8 @@ exports.AuthService = class AuthService {
746
885
  payload,
747
886
  timestamp: new Date().toISOString()
748
887
  };
888
+ // TODO_REMOVE_DEBUG: Temporary debug log - remove after debugging
889
+ console.log('[AuthService] 🔍 DEBUG: emitAuthEvent() called, event type:', event.type);
749
890
  this.eventBus.sendEvent(JSON.stringify(event));
750
891
  console.log('[AuthService] Auth event emitted:', event.type);
751
892
  }