@aakash58/chatbot 1.1.9 → 1.1.10

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.
@@ -567,26 +567,32 @@ class AuthService {
567
567
  * Resolves a federated token from browser storage
568
568
  */
569
569
  resolveSilentToken() {
570
- const commonKeys = ['access_token', 'id_token', 'token', 'authToken'];
571
570
  const configuredKey = this.config?.autoConfigFromStorage;
572
- Logger.info(`[Auth] Resolving token from storage with configured key: ${configuredKey}`);
573
- // Try configured storage key (both localStorage and sessionStorage)
574
- if (configuredKey) {
575
- const token = localStorage.getItem(configuredKey) || sessionStorage.getItem(configuredKey);
576
- if (token) {
577
- Logger.debug(`[Auth] Resolved token from configured key: ${configuredKey}`);
578
- return token;
571
+ // Try ABP official authentication API first
572
+ if (window.abp?.auth?.getToken) {
573
+ try {
574
+ const abpToken = window.abp.auth.getToken();
575
+ if (abpToken) {
576
+ Logger.info(`[Auth] Resolved token from ABP auth service: ${abpToken}`);
577
+ return abpToken;
578
+ }
579
+ Logger.debug('[Auth] ABP auth service returned no token');
580
+ }
581
+ catch (e) {
582
+ Logger.error('[Auth] Error calling abp.auth.getToken():', e);
579
583
  }
580
584
  }
581
- // Try common fallback keys
582
- for (const key of commonKeys) {
583
- const token = localStorage.getItem(key) || sessionStorage.getItem(key);
585
+ // Optional fallback: configured storage key
586
+ if (configuredKey) {
587
+ const token = localStorage.getItem(configuredKey) || sessionStorage.getItem(configuredKey);
584
588
  if (token) {
585
- Logger.debug(`[Auth] Resolved token from fallback key: ${key}`);
586
- Logger.info(`[Auth] Resolved token from fallback key: ${token}`);
589
+ Logger.info(`[Auth] Resolved token from configured key: ${configuredKey}`);
587
590
  return token;
588
591
  }
592
+ Logger.debug(`[Auth] No token found at configured key: ${configuredKey}`);
589
593
  }
594
+ // No token found
595
+ Logger.debug('[Auth] No token could be resolved from ABP or configured storage');
590
596
  return null;
591
597
  }
592
598
  /**