Skip to content

Commit 14a015a

Browse files
authored
Store authentication session ID as machine specific data (microsoft#153846)
Store authentication session ID as machine specific
1 parent f24d09f commit 14a015a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/vs/workbench/services/sessionSync/browser/sessionSyncWorkbenchService.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export class SessionSyncWorkbenchService extends Disposable implements ISessionS
294294
if (sessionId === undefined) {
295295
this.storageService.remove(SessionSyncWorkbenchService.CACHED_SESSION_STORAGE_KEY, StorageScope.APPLICATION);
296296
} else {
297-
this.storageService.store(SessionSyncWorkbenchService.CACHED_SESSION_STORAGE_KEY, sessionId, StorageScope.APPLICATION, StorageTarget.USER);
297+
this.storageService.store(SessionSyncWorkbenchService.CACHED_SESSION_STORAGE_KEY, sessionId, StorageScope.APPLICATION, StorageTarget.MACHINE);
298298
}
299299
}
300300

@@ -306,10 +306,15 @@ export class SessionSyncWorkbenchService extends Disposable implements ISessionS
306306
private async onDidChangeStorage(e: IStorageValueChangeEvent): Promise<void> {
307307
if (e.key === SessionSyncWorkbenchService.CACHED_SESSION_STORAGE_KEY
308308
&& e.scope === StorageScope.APPLICATION
309-
&& this.#authenticationInfo?.sessionId !== this.existingSessionId
310309
) {
311-
this.#authenticationInfo = undefined;
312-
this.initialized = false;
310+
const newSessionId = this.existingSessionId;
311+
const previousSessionId = this.#authenticationInfo?.sessionId;
312+
313+
if (previousSessionId !== newSessionId) {
314+
this.logService.trace(`Edit Sessions: resetting authentication state because authentication session ID preference changed from ${previousSessionId} to ${newSessionId}.`);
315+
this.#authenticationInfo = undefined;
316+
this.initialized = false;
317+
}
313318
}
314319
}
315320

0 commit comments

Comments
 (0)