Await keychain write on logout for github auth

This commit is contained in:
Rachel Macfarlane 2020-04-21 11:15:29 -07:00
parent 37485c2568
commit fd88fb9667
2 changed files with 8 additions and 3 deletions

View file

@ -137,7 +137,7 @@ export class GitHubAuthenticationProvider {
this._sessions.push(session);
}
this.storeSessions();
await this.storeSessions();
}
public async logout(id: string) {
@ -145,9 +145,13 @@ export class GitHubAuthenticationProvider {
if (sessionIndex > -1) {
const session = this._sessions.splice(sessionIndex, 1)[0];
const token = await session.getAccessToken();
await this._githubServer.revokeToken(token);
try {
await this._githubServer.revokeToken(token);
} catch (_) {
// ignore, should still remove from keychain
}
}
this.storeSessions();
await this.storeSessions();
}
}

View file

@ -186,6 +186,7 @@ export class GitHubServer {
Logger.info('Revoked token!');
resolve();
} else {
Logger.info(`Revoking token failed: ${result.statusMessage}`);
reject(new Error(result.statusMessage));
}
});