From f8b17200c1318f0b58090445cc1a6338da426e4e Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 11 Nov 2021 14:24:31 -0800 Subject: [PATCH] refresh more often based on clock skew --- extensions/microsoft-authentication/src/AADHelper.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/microsoft-authentication/src/AADHelper.ts b/extensions/microsoft-authentication/src/AADHelper.ts index 4709ef62db0..5558b908ccb 100644 --- a/extensions/microsoft-authentication/src/AADHelper.ts +++ b/extensions/microsoft-authentication/src/AADHelper.ts @@ -45,6 +45,7 @@ interface ITokenClaims { tid: string; email?: string; unique_name?: string; + exp?: number; preferred_username?: string; oid?: string; altsecid?: string; @@ -182,6 +183,7 @@ export class AzureActiveDirectoryService { }; }); + Logger.trace('storing data into keychain...'); await this._keychain.setToken(JSON.stringify(serializedData)); } @@ -537,7 +539,8 @@ export class AzureActiveDirectoryService { onDidChangeSessions.fire({ added: [], removed: [this.convertToSessionSync(token)], changed: [] }); } } - }, 1000 * (token.expiresIn - 30))); + // For details on why this is set to 2/3... see https://github.com/microsoft/vscode/issues/133201#issuecomment-966668197 + }, 1000 * (token.expiresIn * 2 / 3))); } await this.storeTokenData();