未验证 提交 fc9543ac 编写于 作者: R Rachel Macfarlane 提交者: GitHub

Reset settings sync token on 401, fixes #91653 (#91726)

上级 d685711e
......@@ -155,7 +155,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
this._register(Event.debounce(userDataSyncService.onDidChangeStatus, () => undefined, 500)(() => this.onDidChangeSyncStatus(this.userDataSyncService.status)));
this._register(userDataSyncService.onDidChangeConflicts(() => this.onDidChangeConflicts(this.userDataSyncService.conflictsSources)));
this._register(userDataSyncService.onSyncErrors(errors => this.onSyncErrors(errors)));
this._register(this.authTokenService.onTokenFailed(_ => this.authenticationService.getSessions(this.userDataSyncStore!.authenticationProviderId)));
this._register(this.authTokenService.onTokenFailed(_ => this.onTokenFailed()));
this._register(this.userDataSyncEnablementService.onDidChangeEnablement(enabled => this.onDidChangeEnablement(enabled)));
this._register(this.authenticationService.onDidRegisterAuthenticationProvider(e => this.onDidRegisterAuthenticationProvider(e)));
this._register(this.authenticationService.onDidUnregisterAuthenticationProvider(e => this.onDidUnregisterAuthenticationProvider(e)));
......@@ -255,6 +255,16 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
}
}
private async onTokenFailed(): Promise<void> {
if (this.activeAccount) {
const accounts = (await this.authenticationService.getSessions(this.userDataSyncStore!.authenticationProviderId) || []);
const matchingAccount = accounts.filter(a => a.id === this.activeAccount?.id)[0];
this.setActiveAccount(matchingAccount);
} else {
this.setActiveAccount(undefined);
}
}
private async onDidRegisterAuthenticationProvider(providerId: string) {
if (providerId === this.userDataSyncStore!.authenticationProviderId) {
await this.initializeActiveAccount();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册