From 1765fc824cc65acf78a1fb305c26bc3e62979c37 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 23:33:46 +0000 Subject: [PATCH 1/2] build(deps): bump jwt-decode from 3.1.2 to 4.0.0 Bumps [jwt-decode](https://github.com/auth0/jwt-decode) from 3.1.2 to 4.0.0. - [Release notes](https://github.com/auth0/jwt-decode/releases) - [Changelog](https://github.com/auth0/jwt-decode/blob/main/CHANGELOG.md) - [Commits](https://github.com/auth0/jwt-decode/compare/v3.1.2...v4.0.0) --- updated-dependencies: - dependency-name: jwt-decode dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 11 +++++++---- package.json | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5c10b8a3..670581c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0", "dependencies": { "@reduxjs/toolkit": "^1.9.7", - "jwt-decode": "^3.1.2", + "jwt-decode": "^4.0.0", "lodash": "^4.17.21", "react": "^18.2.0", "react-redux": "^8.1.3", @@ -10841,9 +10841,12 @@ } }, "node_modules/jwt-decode": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-3.1.2.tgz", - "integrity": "sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A==" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz", + "integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==", + "engines": { + "node": ">=18" + } }, "node_modules/kleur": { "version": "3.0.3", diff --git a/package.json b/package.json index 9e3ccdef..4f1a00eb 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ ], "dependencies": { "@reduxjs/toolkit": "^1.9.7", - "jwt-decode": "^3.1.2", + "jwt-decode": "^4.0.0", "lodash": "^4.17.21", "react": "^18.2.0", "react-redux": "^8.1.3", From 25639b5d5d42944f44562ab2636accd122a74a21 Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Mon, 30 Oct 2023 21:06:08 -0400 Subject: [PATCH 2/2] fix: update JWT import for jwt-decode 4 --- src/account/auth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/account/auth.ts b/src/account/auth.ts index 9030d6a8..3aaf26e8 100644 --- a/src/account/auth.ts +++ b/src/account/auth.ts @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. */ -import jwt from 'jwt-decode'; +import { jwtDecode } from 'jwt-decode'; import { UNAUTHENTICATED } from 'terraso-client-shared/account/authConstants'; import { getAPIConfig } from 'terraso-client-shared/config'; @@ -68,5 +68,5 @@ export const refreshToken = async () => { export const getUserEmail = async () => { const token = await getToken(); - return token === undefined ? undefined : jwt(token).email; + return token === undefined ? undefined : jwtDecode(token).email; };