@@ -19,7 +19,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
1919import { IRequestService } from 'vs/platform/request/common/request' ;
2020import { CONFIGURATION_SYNC_STORE_KEY , IUserDataSyncStoreClient , SyncResource } from 'vs/platform/userDataSync/common/userDataSync' ;
2121import { URI } from 'vs/base/common/uri' ;
22- import { AuthenticationSessionInfo , getCurrentAuthenticationSessionInfo } from 'vs/workbench/services/authentication/browser/authenticationService' ;
22+ import { getCurrentAuthenticationSessionInfo } from 'vs/workbench/services/authentication/browser/authenticationService' ;
2323import { getSyncAreaLabel } from 'vs/workbench/services/userDataSync/common/userDataSync' ;
2424import { IWorkbenchContribution , IWorkbenchContributionsRegistry , Extensions } from 'vs/workbench/common/contributions' ;
2525import { Registry } from 'vs/platform/registry/common/platform' ;
@@ -80,13 +80,18 @@ export class UserDataInitializationService implements IUserDataInitializationSer
8080 return ;
8181 }
8282
83- const authenticationSession = await this . getCurrentAuthenticationSessionInfo ( ) ;
83+ if ( ! this . environmentService . options ?. credentialsProvider ) {
84+ this . logService . trace ( `Skipping initializing user data as credentials provider is not provided` ) ;
85+ return ;
86+ }
8487
88+ let authenticationSession ;
89+ try {
90+ authenticationSession = await getCurrentAuthenticationSessionInfo ( this . environmentService , this . productService ) ;
91+ } catch ( error ) {
92+ this . logService . error ( error ) ;
93+ }
8594 if ( ! authenticationSession ) {
86- if ( ! this . environmentService . options ?. credentialsProvider ) {
87- this . logService . trace ( `Skipping initializing user data as credentials provider is not provided` ) ;
88- return ;
89- }
9095 this . logService . trace ( `Skipping initializing user data as authentication session is not set` ) ;
9196 return ;
9297 }
@@ -100,35 +105,6 @@ export class UserDataInitializationService implements IUserDataInitializationSer
100105 return this . _userDataSyncStoreClientPromise ;
101106 }
102107
103- private async getCurrentAuthenticationSessionInfo ( ) : Promise < AuthenticationSessionInfo | undefined > {
104- if ( this . environmentService . options ?. credentialsProvider ) {
105- try {
106- const currentAuthenticationSessionInfo = await getCurrentAuthenticationSessionInfo ( this . environmentService , this . productService ) ;
107- if ( currentAuthenticationSessionInfo ) {
108- return currentAuthenticationSessionInfo ;
109- }
110- } catch ( error ) {
111- this . logService . error ( error ) ;
112- return undefined ;
113- }
114- }
115-
116- if ( ! this . environmentService . isBuilt ) {
117- const authenticationSessionInfoElement = document . getElementById ( 'vscode-workbench-authentication-session' ) ;
118- const authenticationSessionInfoElementAttribute = authenticationSessionInfoElement ? authenticationSessionInfoElement . getAttribute ( 'data-settings' ) : undefined ;
119- if ( authenticationSessionInfoElementAttribute ) {
120- try {
121- return JSON . parse ( authenticationSessionInfoElementAttribute ) ;
122- } catch ( error ) {
123- this . logService . error ( error ) ;
124- return undefined ;
125- }
126- }
127- }
128-
129- return undefined ;
130- }
131-
132108 async initializeRequiredResources ( ) : Promise < void > {
133109 return this . initialize ( [ SyncResource . Settings , SyncResource . GlobalState ] ) ;
134110 }
0 commit comments