diff --git a/src/vs/code/browser/workbench/workbench-dev.html b/src/vs/code/browser/workbench/workbench-dev.html
index 55ae7a39871..aeb8c5e1e66 100644
--- a/src/vs/code/browser/workbench/workbench-dev.html
+++ b/src/vs/code/browser/workbench/workbench-dev.html
@@ -14,8 +14,11 @@
-
+
+
+
+
diff --git a/src/vs/workbench/services/userData/browser/userDataInit.ts b/src/vs/workbench/services/userData/browser/userDataInit.ts
index d3fc176f380..569affa26a9 100644
--- a/src/vs/workbench/services/userData/browser/userDataInit.ts
+++ b/src/vs/workbench/services/userData/browser/userDataInit.ts
@@ -19,7 +19,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
import { IRequestService } from 'vs/platform/request/common/request';
import { CONFIGURATION_SYNC_STORE_KEY, IUserDataSyncStoreClient, SyncResource } from 'vs/platform/userDataSync/common/userDataSync';
import { URI } from 'vs/base/common/uri';
-import { getCurrentAuthenticationSessionInfo } from 'vs/workbench/services/authentication/browser/authenticationService';
+import { AuthenticationSessionInfo, getCurrentAuthenticationSessionInfo } from 'vs/workbench/services/authentication/browser/authenticationService';
import { getSyncAreaLabel } from 'vs/workbench/services/userDataSync/common/userDataSync';
import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions } from 'vs/workbench/common/contributions';
import { Registry } from 'vs/platform/registry/common/platform';
@@ -80,18 +80,13 @@ export class UserDataInitializationService implements IUserDataInitializationSer
return;
}
- if (!this.environmentService.options?.credentialsProvider) {
- this.logService.trace(`Skipping initializing user data as credentials provider is not provided`);
- return;
- }
+ const authenticationSession = await this.getCurrentAuthenticationSessionInfo();
- let authenticationSession;
- try {
- authenticationSession = await getCurrentAuthenticationSessionInfo(this.environmentService, this.productService);
- } catch (error) {
- this.logService.error(error);
- }
if (!authenticationSession) {
+ if (!this.environmentService.options?.credentialsProvider) {
+ this.logService.trace(`Skipping initializing user data as credentials provider is not provided`);
+ return;
+ }
this.logService.trace(`Skipping initializing user data as authentication session is not set`);
return;
}
@@ -105,6 +100,35 @@ export class UserDataInitializationService implements IUserDataInitializationSer
return this._userDataSyncStoreClientPromise;
}
+ private async getCurrentAuthenticationSessionInfo(): Promise {
+ if (this.environmentService.options?.credentialsProvider) {
+ try {
+ const currentAuthenticationSessionInfo = await getCurrentAuthenticationSessionInfo(this.environmentService, this.productService);
+ if (currentAuthenticationSessionInfo) {
+ return currentAuthenticationSessionInfo;
+ }
+ } catch (error) {
+ this.logService.error(error);
+ return undefined;
+ }
+ }
+
+ if (!this.environmentService.isBuilt) {
+ const authenticationSessionInfoElement = document.getElementById('vscode-workbench-authentication-session');
+ const authenticationSessionInfoElementAttribute = authenticationSessionInfoElement ? authenticationSessionInfoElement.getAttribute('data-settings') : undefined;
+ if (authenticationSessionInfoElementAttribute) {
+ try {
+ return JSON.parse(authenticationSessionInfoElementAttribute);
+ } catch (error) {
+ this.logService.error(error);
+ return undefined;
+ }
+ }
+ }
+
+ return undefined;
+ }
+
async initializeRequiredResources(): Promise {
return this.initialize([SyncResource.Settings, SyncResource.GlobalState]);
}