File tree Expand file tree Collapse file tree
src/vs/workbench/contrib/userDataSync/browser Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
155155 this . _register ( Event . debounce ( userDataSyncService . onDidChangeStatus , ( ) => undefined , 500 ) ( ( ) => this . onDidChangeSyncStatus ( this . userDataSyncService . status ) ) ) ;
156156 this . _register ( userDataSyncService . onDidChangeConflicts ( ( ) => this . onDidChangeConflicts ( this . userDataSyncService . conflictsSources ) ) ) ;
157157 this . _register ( userDataSyncService . onSyncErrors ( errors => this . onSyncErrors ( errors ) ) ) ;
158- this . _register ( this . authTokenService . onTokenFailed ( _ => this . authenticationService . getSessions ( this . userDataSyncStore ! . authenticationProviderId ) ) ) ;
158+ this . _register ( this . authTokenService . onTokenFailed ( _ => this . onTokenFailed ( ) ) ) ;
159159 this . _register ( this . userDataSyncEnablementService . onDidChangeEnablement ( enabled => this . onDidChangeEnablement ( enabled ) ) ) ;
160160 this . _register ( this . authenticationService . onDidRegisterAuthenticationProvider ( e => this . onDidRegisterAuthenticationProvider ( e ) ) ) ;
161161 this . _register ( this . authenticationService . onDidUnregisterAuthenticationProvider ( e => this . onDidUnregisterAuthenticationProvider ( e ) ) ) ;
@@ -255,6 +255,16 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
255255 }
256256 }
257257
258+ private async onTokenFailed ( ) : Promise < void > {
259+ if ( this . activeAccount ) {
260+ const accounts = ( await this . authenticationService . getSessions ( this . userDataSyncStore ! . authenticationProviderId ) || [ ] ) ;
261+ const matchingAccount = accounts . filter ( a => a . id === this . activeAccount ?. id ) [ 0 ] ;
262+ this . setActiveAccount ( matchingAccount ) ;
263+ } else {
264+ this . setActiveAccount ( undefined ) ;
265+ }
266+ }
267+
258268 private async onDidRegisterAuthenticationProvider ( providerId : string ) {
259269 if ( providerId === this . userDataSyncStore ! . authenticationProviderId ) {
260270 await this . initializeActiveAccount ( ) ;
You can’t perform that action at this time.
0 commit comments