From ab15a409b207695d7093cd0990a7df8c38b7020a Mon Sep 17 00:00:00 2001 From: NipuniBhagya Date: Fri, 27 Mar 2026 17:13:14 +0530 Subject: [PATCH 1/3] Add tokenLifecycle.refreshToken.autoRefresh config to replace legacy periodicTokenRefresh --- .changeset/petite-taxes-press.md | 6 ++++++ packages/javascript/src/models/config.ts | 17 ++++++++++++++++- packages/react/src/AsgardeoReactClient.ts | 8 ++++++-- 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 .changeset/petite-taxes-press.md diff --git a/.changeset/petite-taxes-press.md b/.changeset/petite-taxes-press.md new file mode 100644 index 00000000..d8c86f45 --- /dev/null +++ b/.changeset/petite-taxes-press.md @@ -0,0 +1,6 @@ +--- +'@asgardeo/javascript': patch +'@asgardeo/react': patch +--- + +Add tokenLifecycle.refreshToken.autoRefresh config to replace legacy periodicTokenRefresh diff --git a/packages/javascript/src/models/config.ts b/packages/javascript/src/models/config.ts index e08a4f49..7d671c03 100644 --- a/packages/javascript/src/models/config.ts +++ b/packages/javascript/src/models/config.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). + * Copyright (c) 2025-2026, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -307,6 +307,21 @@ export interface BaseConfig extends WithPreferences { */ syncSession?: boolean; + /** + * Configuration for token lifecycle management. + */ + tokenLifecycle?: { + /** + * Configuration for refresh token behavior. + */ + refreshToken?: { + /** + * Whether to automatically refresh the access token periodically before it expires. + */ + autoRefresh?: boolean; + }; + }; + /** * Token validation configuration. * This allows you to configure how the SDK validates tokens received from the authorization server. diff --git a/packages/react/src/AsgardeoReactClient.ts b/packages/react/src/AsgardeoReactClient.ts index 994bc387..1d98739d 100644 --- a/packages/react/src/AsgardeoReactClient.ts +++ b/packages/react/src/AsgardeoReactClient.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). + * Copyright (c) 2025-2026, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -126,7 +126,11 @@ class AsgardeoReactClient e } return this.withLoading(async () => { - this.initializeConfig = {...config, organizationHandle: resolvedOrganizationHandle}; + this.initializeConfig = { + ...config, + organizationHandle: resolvedOrganizationHandle, + periodicTokenRefresh: config?.tokenLifecycle?.refreshToken?.autoRefresh ?? (config as any)?.periodicTokenRefresh, + }; return this.asgardeo.init(this.initializeConfig as any); }); From 293e87a94633070169e6d3117489e325f89fde93 Mon Sep 17 00:00:00 2001 From: NipuniBhagya Date: Tue, 31 Mar 2026 12:55:32 +0530 Subject: [PATCH 2/3] Fix eslint issue --- packages/react/src/AsgardeoReactClient.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react/src/AsgardeoReactClient.ts b/packages/react/src/AsgardeoReactClient.ts index 1d98739d..d7aa30c4 100644 --- a/packages/react/src/AsgardeoReactClient.ts +++ b/packages/react/src/AsgardeoReactClient.ts @@ -129,7 +129,8 @@ class AsgardeoReactClient e this.initializeConfig = { ...config, organizationHandle: resolvedOrganizationHandle, - periodicTokenRefresh: config?.tokenLifecycle?.refreshToken?.autoRefresh ?? (config as any)?.periodicTokenRefresh, + periodicTokenRefresh: config?.tokenLifecycle?.refreshToken?.autoRefresh + ?? (config as any)?.periodicTokenRefresh, }; return this.asgardeo.init(this.initializeConfig as any); From 5611bc24a75f56f0cb1df9af5c9fb6e4228af88e Mon Sep 17 00:00:00 2001 From: Nipuni Paaris Date: Tue, 31 Mar 2026 12:57:47 +0530 Subject: [PATCH 3/3] Update changeset file Updated versioning for @asgardeo/javascript and @asgardeo/react to minor. Added tokenLifecycle.refreshToken.autoRefresh configuration to replace legacy periodicTokenRefresh. --- .changeset/petite-taxes-press.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/petite-taxes-press.md b/.changeset/petite-taxes-press.md index d8c86f45..c85997e9 100644 --- a/.changeset/petite-taxes-press.md +++ b/.changeset/petite-taxes-press.md @@ -1,6 +1,6 @@ --- -'@asgardeo/javascript': patch -'@asgardeo/react': patch +'@asgardeo/javascript': minor +'@asgardeo/react': minor --- Add tokenLifecycle.refreshToken.autoRefresh config to replace legacy periodicTokenRefresh