From 069b4b28f14d70f9ab0b92222978fc23b0f478cf Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 11 Jun 2024 14:29:19 +0900 Subject: [PATCH 1/2] fix: correct the constructor of AWSStorageService --- src/core/aws-web.core.ts | 1 + src/token-storage/aws-storage.service.ts | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/aws-web.core.ts b/src/core/aws-web.core.ts index d07e9ad..61f1d65 100644 --- a/src/core/aws-web.core.ts +++ b/src/core/aws-web.core.ts @@ -43,6 +43,7 @@ export class AWSWebCore implements WebCoreService { * @throws {Error} - Throws an error if there is no cached token. */ async init(): Promise { + await this.tokenStorage.initLemonConfig(); const hasCachedToken = await this.tokenStorage.hasCachedToken(); if (!hasCachedToken) { this.logger.warn('initialized without token!'); diff --git a/src/token-storage/aws-storage.service.ts b/src/token-storage/aws-storage.service.ts index 7f427a5..ea7a07f 100644 --- a/src/token-storage/aws-storage.service.ts +++ b/src/token-storage/aws-storage.service.ts @@ -17,7 +17,6 @@ export class AWSStorageService extends TokenStorageService { constructor(readonly config: WebCoreConfig<'aws'>) { super(config); - this.initLemonConfig().then(() => {}); } async initLemonConfig() { From 5653596bfd11eed96b62bd87d80e4018fc270243 Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 11 Jun 2024 14:31:11 +0900 Subject: [PATCH 2/2] feat: add getTokenStorage method to AWSWebCore and AzureWebCore --- src/core/aws-web.core.ts | 9 +++++++++ src/core/azure-web.core.ts | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/core/aws-web.core.ts b/src/core/aws-web.core.ts index 61f1d65..62fd942 100644 --- a/src/core/aws-web.core.ts +++ b/src/core/aws-web.core.ts @@ -73,6 +73,15 @@ export class AWSWebCore implements WebCoreService { return 'build'; } + /** + * Retrieves the token storage service. + * + * @returns {AWSStorageService} - The storage service that manages OAuth tokens. + */ + getTokenStorage(): AWSStorageService { + return this.tokenStorage; + } + /** * Builds a request using HttpRequestBuilder without Credentials. * @param {AxiosRequestConfig} config - The Axios request configuration. diff --git a/src/core/azure-web.core.ts b/src/core/azure-web.core.ts index 33228f8..7f63224 100644 --- a/src/core/azure-web.core.ts +++ b/src/core/azure-web.core.ts @@ -41,6 +41,15 @@ export class AzureWebCore implements WebCoreService { return 'has-token'; } + /** + * Retrieves the token storage service. + * + * @returns {AzureStorageService} - The storage service that manages OAuth tokens. + */ + getTokenStorage(): AzureStorageService { + return this.tokenStorage; + } + /** * Builds a request using HttpRequestBuilder without Credentials. * @param {AxiosRequestConfig} config - The Axios request configuration.