From bd4a646644e78cf83e5e99a42e6c3ad9121b6db4 Mon Sep 17 00:00:00 2001 From: Bruce McLean Date: Thu, 7 Dec 2023 17:12:41 -0500 Subject: [PATCH] bugfix 548 / fix for invalid user token (#611) * fix for invalid user token * update lock file * updated dependencies * updated dependencies --------- Co-authored-by: PhotoNomad0 --- package.json | 2 +- src/context/AuthContext.js | 13 +++++++++---- yarn.lock | 26 +++++++++++++------------- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 995ce2c0..6919743c 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "react-icons": "^4.8.0", "regenerator-runtime": "^0.13.7", "resource-workspace-rcl": "2.1.4", - "scripture-resources-rcl": "5.5.8", + "scripture-resources-rcl": "5.5.9", "scripture-tsv": "0.4.0", "single-scripture-rcl": "3.4.17", "tailwindcss": "^2.0.4", diff --git a/src/context/AuthContext.js b/src/context/AuthContext.js index b0125c10..a4b661f5 100644 --- a/src/context/AuthContext.js +++ b/src/context/AuthContext.js @@ -48,18 +48,23 @@ export default function AuthContextProvider(props) { const httpCode = response?.status || 0 if (httpCode !== 200) { - console.log(`TranslationSettings - error fetching user info, status code ${httpCode}`) + console.log(`getAuth() - error fetching user info, status code ${httpCode}`) if (unAuthenticated(httpCode)) { - console.log(`TranslationSettings - user not authenticated, going to login`) + console.error(`getAuth() - user not authenticated, going to login`) logout() } else { processError(null, httpCode) } } }).catch(e => { - console.warn(`TranslationSettings - hard error fetching user info, error=`, e) - processError(e) + if (e.toString().includes('401')) { // check if 401 code in exception + console.error(`getAuth() - user token expired`) + logout() + } else { + console.warn(`getAuth() - hard error fetching user info, error=`, e) + processError(e) + } }) } return auth diff --git a/yarn.lock b/yarn.lock index 7a3760c7..facdf8b2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2421,9 +2421,9 @@ "@types/react" "^17" "@types/react-dom@^17.0.0": - version "17.0.25" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.25.tgz#e0e5b3571e1069625b3a3da2b279379aa33a0cb5" - integrity sha512-urx7A7UxkZQmThYA4So0NelOVjx3V4rNFVJwp0WZlbIK5eM4rNJDiN3R/E9ix0MBh6kAEojk/9YL+Te6D9zHNA== + version "17.0.22" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.22.tgz#34317e08be27b33fa9e7cdb56125b22538261bad" + integrity sha512-wHt4gkdSMb4jPp1vc30MLJxoWGsZs88URfmt3FRXoOEYrrqK3I8IuZLE/uFBb4UT6MRfI0wXFu4DS7LS0kUC7Q== dependencies: "@types/react" "^17" @@ -2467,9 +2467,9 @@ csstype "^3.0.2" "@types/react@^17.0.0": - version "17.0.71" - resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.71.tgz#3673d446ad482b1564e44bf853b3ab5bcbc942c4" - integrity sha512-lfqOu9mp16nmaGRrS8deS2Taqhd5Ih0o92Te5Ws6I1py4ytHBcXLqh0YIqVsViqwVI5f+haiFM6hju814BzcmA== + version "17.0.69" + resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.69.tgz#245a0cf2f5b0fb1d645691d3083e3c7d4409b98f" + integrity sha512-klEeru//GhiQvXUBayz0Q4l3rKHWsBR/EUOhOeow6hK2jV7MlO44+8yEk6+OtPeOlRfnpUnrLXzGK+iGph5aeg== dependencies: "@types/prop-types" "*" "@types/scheduler" "*" @@ -9877,10 +9877,10 @@ schema-utils@^3.0.0: ajv "^6.12.5" ajv-keywords "^3.5.2" -scripture-resources-rcl@5.5.8: - version "5.5.8" - resolved "https://registry.yarnpkg.com/scripture-resources-rcl/-/scripture-resources-rcl-5.5.8.tgz#edca70cb18f8c02b1c9c195a43bb3e8044fa6a09" - integrity sha512-RC82kGdA8jaclxwABRXFJkw9Bh5Ig3juBJY+vig8qsVLEU6EiHSuB5htz8BxkNPVUw7y5wpxxJeCb0rEATmEJA== +scripture-resources-rcl@5.5.9: + version "5.5.9" + resolved "https://registry.yarnpkg.com/scripture-resources-rcl/-/scripture-resources-rcl-5.5.9.tgz#a82ec412b92e4b64b3e75e220db8577410badb83" + integrity sha512-riVKnzK3xyQO+YSXIz8N4am2cz6WTcNPjoZNF36bo2mFlDPSzCE2nbH48pvMiy0cxwvzfmScuvJcwbbqR5Na9w== dependencies: bible-reference-range "^1.1.0" deep-freeze "^0.0.1" @@ -11055,9 +11055,9 @@ typedarray-to-buffer@^3.1.5: is-typedarray "^1.0.0" typescript@^5.2.2: - version "5.3.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.2.tgz#00d1c7c1c46928c5845c1ee8d0cc2791031d4c43" - integrity sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ== + version "5.2.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78" + integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w== ua-parser-js@^0.7.30: version "0.7.34"