diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e5ff1343f2..b0ca237c0c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -70,7 +70,9 @@ jobs: steps: - name: Install gnome-keyring if: ${{ matrix.os=='ubuntu-latest' }} - run: sudo apt-get install -y gnome-keyring dbus-x11 + run: | + sudo apt-get update + sudo apt-get install -y gnome-keyring dbus-x11 - name: Checkout repo uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 diff --git a/libs/common/src/services/api.service.ts b/libs/common/src/services/api.service.ts index 7c39958bce..6c15d85c0d 100644 --- a/libs/common/src/services/api.service.ts +++ b/libs/common/src/services/api.service.ts @@ -2360,16 +2360,6 @@ export class ApiService implements ApiServiceAbstraction { tokenError: boolean, authed: boolean ): Promise { - if ( - authed && - ((tokenError && response.status === 400) || - response.status === 401 || - response.status === 403) - ) { - await this.logoutCallback(true); - return null; - } - let responseJson: any = null; if (this.isJsonResponse(response)) { responseJson = await response.json(); @@ -2377,6 +2367,20 @@ export class ApiService implements ApiServiceAbstraction { responseJson = { Message: await response.text() }; } + if (authed) { + if ( + response.status === 401 || + response.status === 403 || + (tokenError && + response.status === 400 && + responseJson != null && + responseJson.error === "invalid_grant") + ) { + await this.logoutCallback(true); + return null; + } + } + return new ErrorResponse(responseJson, response.status, tokenError); }