From 46eafaab8d0f8465afb485b32656a0ca14f9eec5 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 1 Nov 2022 08:09:39 -0400 Subject: [PATCH] revert file changes --- .github/workflows/test.yml | 4 +++- libs/common/src/services/api.service.ts | 24 ++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e5ff1343f2e7..b0ca237c0cc6 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 7c39958bce39..6c15d85c0d1d 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); }