From e2fe6a414ba060a216f9b713c5fa8ac5ee021880 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Mon, 26 Sep 2022 17:09:47 +0300 Subject: [PATCH] add max value on calcTimeout function --- projects/lib/src/oauth-service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/lib/src/oauth-service.ts b/projects/lib/src/oauth-service.ts index a5fbfd14..8d08c006 100644 --- a/projects/lib/src/oauth-service.ts +++ b/projects/lib/src/oauth-service.ts @@ -495,7 +495,9 @@ export class OAuthService extends AuthConfig implements OnDestroy { const now = this.dateTimeService.now(); const delta = (expiration - storedAt) * this.timeoutFactor - (now - storedAt); - return Math.max(0, delta); + const duration = Math.max(0, delta); + const maxTimeoutValue = 2_147_483_647; + return duration > maxTimeoutValue ? maxTimeoutValue : duration; } /**