From 4ef07faf13db8a155e11e802fcf7ff4efa4c160f Mon Sep 17 00:00:00 2001 From: Ajima Chukwuemeka <32770340+ajimae@users.noreply.github.com> Date: Tue, 23 Aug 2022 22:45:30 +0200 Subject: [PATCH] fix(auth-token): reduce token fetch window (#1805) - reduce token fetch window from 2 hours to 5 minutes - add changeset to release changes --- .changeset/healthy-donuts-grow.md | 5 +++++ packages/sdk-middleware-auth/src/base-auth-flow.js | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/healthy-donuts-grow.md diff --git a/.changeset/healthy-donuts-grow.md b/.changeset/healthy-donuts-grow.md new file mode 100644 index 000000000..ddea8c512 --- /dev/null +++ b/.changeset/healthy-donuts-grow.md @@ -0,0 +1,5 @@ +--- +'@commercetools/sdk-middleware-auth': patch +--- + +Change token fetch window from 2 hours to 5 minutes. diff --git a/packages/sdk-middleware-auth/src/base-auth-flow.js b/packages/sdk-middleware-auth/src/base-auth-flow.js index 0e19434c1..c0c636b5e 100644 --- a/packages/sdk-middleware-auth/src/base-auth-flow.js +++ b/packages/sdk-middleware-auth/src/base-auth-flow.js @@ -29,8 +29,8 @@ function calculateExpirationTime(expiresIn: number): number { return ( Date.now() + expiresIn * 1000 - - // Add a gap of 2 hours before expiration time. - 2 * 60 * 60 * 1000 + // Add a gap of 5 minutes before expiration time. + 5 * 60 * 1000 ) }