From cb75e572408148f325504ae939fb5af36ab61154 Mon Sep 17 00:00:00 2001 From: Laurin Quast Date: Mon, 11 Nov 2024 14:33:56 +0100 Subject: [PATCH 1/2] chore: upgrade supertokens-auth-react to 41.x --- packages/services/api/package.json | 2 +- packages/services/server/package.json | 2 +- packages/web/app/package.json | 4 +- pnpm-lock.yaml | 83 ++++++++++++++++----------- 4 files changed, 54 insertions(+), 37 deletions(-) diff --git a/packages/services/api/package.json b/packages/services/api/package.json index 55e1c73e20..1dca9dba4a 100644 --- a/packages/services/api/package.json +++ b/packages/services/api/package.json @@ -60,7 +60,7 @@ "prom-client": "15.1.3", "redlock": "5.0.0-beta.2", "slonik": "30.4.4", - "supertokens-node": "16.7.5", + "supertokens-node": "16.7.6", "tslib": "2.8.0", "undici": "6.20.1", "vitest": "2.0.5", diff --git a/packages/services/server/package.json b/packages/services/server/package.json index b09fa97c29..c473d24907 100644 --- a/packages/services/server/package.json +++ b/packages/services/server/package.json @@ -46,7 +46,7 @@ "prom-client": "15.1.3", "reflect-metadata": "0.2.2", "supertokens-js-override": "0.0.4", - "supertokens-node": "16.7.5", + "supertokens-node": "16.7.6", "tslib": "2.8.0", "zod": "3.23.8" }, diff --git a/packages/web/app/package.json b/packages/web/app/package.json index 4802300875..8ebb01a2d6 100644 --- a/packages/web/app/package.json +++ b/packages/web/app/package.json @@ -115,8 +115,8 @@ "regenerator-runtime": "0.14.1", "snarkdown": "2.0.0", "storybook": "8.3.6", - "supertokens-auth-react": "0.38.0", - "supertokens-web-js": "0.9.0", + "supertokens-auth-react": "0.41.1", + "supertokens-web-js": "0.11.0", "tailwind-merge": "2.5.4", "tailwindcss": "3.4.14", "tailwindcss-animate": "1.0.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d90e7ac7d1..3047592241 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -796,8 +796,8 @@ importers: specifier: 30.4.4 version: 30.4.4(patch_hash=jxrvl4xmdvyktjijg7yfdkb34i) supertokens-node: - specifier: 16.7.5 - version: 16.7.5(encoding@0.1.13) + specifier: 16.7.6 + version: 16.7.6(encoding@0.1.13) tslib: specifier: 2.8.0 version: 2.8.0 @@ -1250,8 +1250,8 @@ importers: specifier: 0.0.4 version: 0.0.4 supertokens-node: - specifier: 16.7.5 - version: 16.7.5(encoding@0.1.13) + specifier: 16.7.6 + version: 16.7.6(encoding@0.1.13) tslib: specifier: 2.8.0 version: 2.8.0 @@ -1953,11 +1953,11 @@ importers: specifier: 8.3.6 version: 8.3.6 supertokens-auth-react: - specifier: 0.38.0 - version: 0.38.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(supertokens-web-js@0.9.0) + specifier: 0.41.1 + version: 0.41.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(supertokens-web-js@0.11.0) supertokens-web-js: - specifier: 0.9.0 - version: 0.9.0 + specifier: 0.11.0 + version: 0.11.0 tailwind-merge: specifier: 2.5.4 version: 2.5.4 @@ -13625,6 +13625,9 @@ packages: resolution: {integrity: sha512-pMpnA0qRdFp32b1sJl1wOJNxZLQ2cbQx+k6tjNtZ8CpvVhNqEPRgivZ2WOUev2YMajecdH7ctUPDvEe87nariQ==} engines: {node: '>=6.0.0'} + qr.js@0.0.0: + resolution: {integrity: sha512-c4iYnWb+k2E+vYpRimHqSu575b1/wKl4XFeJGpFmrJQz5I88v9aY2czh7s0w36srfCM1sXgC/xpoJz5dJfq+OQ==} + qs@6.13.0: resolution: {integrity: sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==} engines: {node: '>=0.6'} @@ -13760,6 +13763,11 @@ packages: peerDependencies: react: '>=16.6.0' + react-qr-code@2.0.15: + resolution: {integrity: sha512-MkZcjEXqVKqXEIMVE0mbcGgDpkfSdd8zhuzXEl9QzYeNcw8Hq2oVIzDLWuZN2PQBwM5PWjc2S31K8Q1UbcFMfw==} + peerDependencies: + react: '*' + react-refresh@0.14.2: resolution: {integrity: sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==} engines: {node: '>=0.10.0'} @@ -14689,25 +14697,25 @@ packages: engines: {node: '>=16 || 14 >=14.17'} hasBin: true - supertokens-auth-react@0.38.0: - resolution: {integrity: sha512-MOFSZtmcbpp65hEXeCmn3hwiPVLnkcpW97U9J36osbqRH9eI6MD0HiRkKG8KvA+vV+FIaC2xiCu9OOLmyZk1EA==} + supertokens-auth-react@0.41.1: + resolution: {integrity: sha512-BkGY2fbSsO0huXLdxZ7Te0TDQ2NTjfKKezFSE8HRah58E1Rqr4DpPS5TqZ6QZ17ans5r2KsYc0lfw5y/HgFRew==} engines: {node: '>=16.0.0', npm: '>=8'} peerDependencies: react: '>=16.8.0' react-dom: '>=16.8.0' - supertokens-web-js: ^0.9.0 + supertokens-web-js: ^0.11.0 supertokens-js-override@0.0.4: resolution: {integrity: sha512-r0JFBjkMIdep3Lbk3JA+MpnpuOtw4RSyrlRAbrzMcxwiYco3GFWl/daimQZ5b1forOiUODpOlXbSOljP/oyurg==} - supertokens-node@16.7.5: - resolution: {integrity: sha512-xrVwi0GfgLIqHKaWXEp7fCgmVQ2wTiJTHG2CQGLkGMvrO9dUcxY+H6qozn3EvyXxbkm1BmflYD8N7ILNSIbR1g==} + supertokens-node@16.7.6: + resolution: {integrity: sha512-2yqoF6vvpfJEd66Ug261I2IsVrHO3D2XPaY3Xeo5A3CL3V/LIQ9zGfcgS0fDdx49F6Ep2DDqQ35zzgqVRMPaXg==} - supertokens-web-js@0.9.0: - resolution: {integrity: sha512-7DucVUWxImrcjckza0oW6tkPfMzScj8V/qiQNZeUT/EfCqIbslNSO8holBHc9Eykc0vG/CC0d9ne5TRhAmRcxg==} + supertokens-web-js@0.11.0: + resolution: {integrity: sha512-6jMmwkR+qi+cOpeymuczKqjHGK/9/1Ckfv8MUFN54k4/4Bs1FMF6wJofTuXOZHEZX80wKZmOHJKQERm8IhBWWg==} - supertokens-website@18.0.2: - resolution: {integrity: sha512-M0E1yukkb5gUlVoONe56FPRHhcnCdgBfrMZiSHUle5o/sQNKafG3P+dRk2TOg22Bj0yt0iv/ah3j+MjAQMVYiA==} + supertokens-website@20.1.5: + resolution: {integrity: sha512-2yN42BvHY41/pNIFdJTKSRW3sWZzfOY607i6cY+WWjHSAx7ppMgujyk8tKj+fiQ4MLWCk3HL6QsXZl0zLV4yEw==} supports-color@4.5.0: resolution: {integrity: sha512-ycQR/UbvI9xIlEdQT1TQqwoXtEldExbCEAJgRo5YXlmSKjv6ThHnP9/vwGa1gr19Gfw+LkFd7KqYMhzrRC5JYw==} @@ -16235,8 +16243,8 @@ snapshots: dependencies: '@aws-crypto/sha256-browser': 3.0.0 '@aws-crypto/sha256-js': 3.0.0 - '@aws-sdk/client-sso-oidc': 3.596.0 - '@aws-sdk/client-sts': 3.596.0(@aws-sdk/client-sso-oidc@3.596.0) + '@aws-sdk/client-sso-oidc': 3.596.0(@aws-sdk/client-sts@3.596.0) + '@aws-sdk/client-sts': 3.596.0 '@aws-sdk/core': 3.592.0 '@aws-sdk/credential-provider-node': 3.596.0(@aws-sdk/client-sso-oidc@3.596.0)(@aws-sdk/client-sts@3.596.0) '@aws-sdk/middleware-host-header': 3.577.0 @@ -16343,11 +16351,11 @@ snapshots: transitivePeerDependencies: - aws-crt - '@aws-sdk/client-sso-oidc@3.596.0': + '@aws-sdk/client-sso-oidc@3.596.0(@aws-sdk/client-sts@3.596.0)': dependencies: '@aws-crypto/sha256-browser': 3.0.0 '@aws-crypto/sha256-js': 3.0.0 - '@aws-sdk/client-sts': 3.596.0(@aws-sdk/client-sso-oidc@3.596.0) + '@aws-sdk/client-sts': 3.596.0 '@aws-sdk/core': 3.592.0 '@aws-sdk/credential-provider-node': 3.596.0(@aws-sdk/client-sso-oidc@3.596.0)(@aws-sdk/client-sts@3.596.0) '@aws-sdk/middleware-host-header': 3.577.0 @@ -16386,6 +16394,7 @@ snapshots: '@smithy/util-utf8': 3.0.0 tslib: 2.8.0 transitivePeerDependencies: + - '@aws-sdk/client-sts' - aws-crt '@aws-sdk/client-sso-oidc@3.682.0(@aws-sdk/client-sts@3.682.0)': @@ -16519,11 +16528,11 @@ snapshots: transitivePeerDependencies: - aws-crt - '@aws-sdk/client-sts@3.596.0(@aws-sdk/client-sso-oidc@3.596.0)': + '@aws-sdk/client-sts@3.596.0': dependencies: '@aws-crypto/sha256-browser': 3.0.0 '@aws-crypto/sha256-js': 3.0.0 - '@aws-sdk/client-sso-oidc': 3.596.0 + '@aws-sdk/client-sso-oidc': 3.596.0(@aws-sdk/client-sts@3.596.0) '@aws-sdk/core': 3.592.0 '@aws-sdk/credential-provider-node': 3.596.0(@aws-sdk/client-sso-oidc@3.596.0)(@aws-sdk/client-sts@3.596.0) '@aws-sdk/middleware-host-header': 3.577.0 @@ -16562,7 +16571,6 @@ snapshots: '@smithy/util-utf8': 3.0.0 tslib: 2.8.0 transitivePeerDependencies: - - '@aws-sdk/client-sso-oidc' - aws-crt '@aws-sdk/client-sts@3.682.0': @@ -16676,7 +16684,7 @@ snapshots: '@aws-sdk/credential-provider-ini@3.596.0(@aws-sdk/client-sso-oidc@3.596.0)(@aws-sdk/client-sts@3.596.0)': dependencies: - '@aws-sdk/client-sts': 3.596.0(@aws-sdk/client-sso-oidc@3.596.0) + '@aws-sdk/client-sts': 3.596.0 '@aws-sdk/credential-provider-env': 3.587.0 '@aws-sdk/credential-provider-http': 3.596.0 '@aws-sdk/credential-provider-process': 3.587.0 @@ -16795,7 +16803,7 @@ snapshots: '@aws-sdk/credential-provider-web-identity@3.587.0(@aws-sdk/client-sts@3.596.0)': dependencies: - '@aws-sdk/client-sts': 3.596.0(@aws-sdk/client-sso-oidc@3.596.0) + '@aws-sdk/client-sts': 3.596.0 '@aws-sdk/types': 3.577.0 '@smithy/property-provider': 3.1.8 '@smithy/types': 3.6.0 @@ -16968,7 +16976,7 @@ snapshots: '@aws-sdk/token-providers@3.587.0(@aws-sdk/client-sso-oidc@3.596.0)': dependencies: - '@aws-sdk/client-sso-oidc': 3.596.0 + '@aws-sdk/client-sso-oidc': 3.596.0(@aws-sdk/client-sts@3.596.0) '@aws-sdk/types': 3.577.0 '@smithy/property-provider': 3.1.8 '@smithy/shared-ini-file-loader': 3.1.9 @@ -30932,6 +30940,8 @@ snapshots: pvutils@1.1.3: {} + qr.js@0.0.0: {} + qs@6.13.0: dependencies: side-channel: 1.0.6 @@ -31073,6 +31083,12 @@ snapshots: react: 18.3.1 react-fast-compare: 3.2.2 + react-qr-code@2.0.15(react@18.3.1): + dependencies: + prop-types: 15.8.1 + qr.js: 0.0.0 + react: 18.3.1 + react-refresh@0.14.2: {} react-remove-scroll-bar@2.3.6(@types/react@18.3.12)(react@18.3.1): @@ -32222,18 +32238,19 @@ snapshots: pirates: 4.0.5 ts-interface-checker: 0.1.13 - supertokens-auth-react@0.38.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(supertokens-web-js@0.9.0): + supertokens-auth-react@0.41.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(supertokens-web-js@0.11.0): dependencies: intl-tel-input: 17.0.19 prop-types: 15.8.1 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) + react-qr-code: 2.0.15(react@18.3.1) supertokens-js-override: 0.0.4 - supertokens-web-js: 0.9.0 + supertokens-web-js: 0.11.0 supertokens-js-override@0.0.4: {} - supertokens-node@16.7.5(encoding@0.1.13): + supertokens-node@16.7.6(encoding@0.1.13): dependencies: content-type: 1.0.5 cookie: 0.7.2 @@ -32251,12 +32268,12 @@ snapshots: - encoding - supports-color - supertokens-web-js@0.9.0: + supertokens-web-js@0.11.0: dependencies: supertokens-js-override: 0.0.4 - supertokens-website: 18.0.2 + supertokens-website: 20.1.5 - supertokens-website@18.0.2: + supertokens-website@20.1.5: dependencies: browser-tabs-lock: 1.3.0 supertokens-js-override: 0.0.4 From 52d6ee039f0d2f6670e3ac366aeb68c6758496be Mon Sep 17 00:00:00 2001 From: Laurin Quast Date: Mon, 11 Nov 2024 14:42:38 +0100 Subject: [PATCH 2/2] move getRedirectionURL callback --- .../app/src/config/supertokens/frontend.ts | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/web/app/src/config/supertokens/frontend.ts b/packages/web/app/src/config/supertokens/frontend.ts index cc9f8990ed..ed53691fc3 100644 --- a/packages/web/app/src/config/supertokens/frontend.ts +++ b/packages/web/app/src/config/supertokens/frontend.ts @@ -1,5 +1,6 @@ import Provider from 'supertokens-auth-react/lib/build/recipe/thirdparty/providers'; import { CustomProviderConfig } from 'supertokens-auth-react/lib/build/recipe/thirdparty/providers/types'; +import type { SuperTokensConfig } from 'supertokens-auth-react/lib/build/types'; import EmailVerification from 'supertokens-auth-react/recipe/emailverification'; import SessionReact from 'supertokens-auth-react/recipe/session'; import ThirdPartyEmailPasswordReact from 'supertokens-auth-react/recipe/thirdpartyemailpassword'; @@ -10,7 +11,7 @@ import { getOIDCOverrides, } from '@/lib/supertokens/third-party-email-password-react-oidc-provider'; -export const frontendConfig = () => { +export const frontendConfig = (): SuperTokensConfig => { const providers: Array = []; if (env.auth.github === true) { @@ -68,16 +69,6 @@ export const frontendConfig = () => { ], }, }, - async getRedirectionURL(context) { - if (context.action === 'SUCCESS') { - // Allow only local pages to be redirected to - if (context.redirectToPath !== undefined && /^\/[^/]+/.test(context.redirectToPath)) { - // we are navigating back to where the user was before they authenticated - return context.redirectToPath; - } - return '/'; - } - }, override: env.auth.oidc ? getOIDCOverrides() : undefined, }), EmailVerification.init({ @@ -85,5 +76,15 @@ export const frontendConfig = () => { }), SessionReact.init(), ], + async getRedirectionURL(context) { + if (context.action === 'SUCCESS') { + // Allow only local pages to be redirected to + if (context.redirectToPath !== undefined && /^\/[^/]+/.test(context.redirectToPath)) { + // we are navigating back to where the user was before they authenticated + return context.redirectToPath; + } + return '/'; + } + }, }; };