Fix external auth reconnection loop if connection lost after refresh token expiration (#8279)

This commit is contained in:
chriss158 2021-01-29 13:40:09 +01:00 committed by GitHub
parent 566ffe24a4
commit bd59c4fccf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,8 +68,14 @@ export class ExternalAuth extends Auth {
public async refreshAccessToken(force?: boolean) {
if (this._tokenCallbackPromise && !force) {
await this._tokenCallbackPromise;
return;
try {
await this._tokenCallbackPromise;
return;
} catch (e) {
// _tokenCallbackPromise is in a rejected state
// Clear the _tokenCallbackPromise and go on refreshing access token
this._tokenCallbackPromise = undefined;
}
}
const payload: GetExternalAuthPayload = {
callback: CALLBACK_SET_TOKEN,