diff --git a/.changeset/gold-boxes-stare.md b/.changeset/gold-boxes-stare.md new file mode 100644 index 000000000..fc9988c15 --- /dev/null +++ b/.changeset/gold-boxes-stare.md @@ -0,0 +1,5 @@ +--- +'@codeimage/app': patch +--- + +update auth0 to 2.0.0 diff --git a/apps/codeimage/package.json b/apps/codeimage/package.json index b8255e3a0..e8cf64630 100644 --- a/apps/codeimage/package.json +++ b/apps/codeimage/package.json @@ -34,7 +34,7 @@ "workbox-window": "^6.5.4" }, "dependencies": { - "@auth0/auth0-spa-js": "1.22.5", + "@auth0/auth0-spa-js": "^2.0.0", "@codeimage/api": "workspace:*", "@codeimage/atomic-state": "workspace:*", "@codeimage/config": "workspace:*", diff --git a/apps/codeimage/src/core/constants/auth0.ts b/apps/codeimage/src/core/constants/auth0.ts index ec6d34c14..23c365522 100644 --- a/apps/codeimage/src/core/constants/auth0.ts +++ b/apps/codeimage/src/core/constants/auth0.ts @@ -8,12 +8,14 @@ function createAuth0(): Promise { createAuth0Client(), ); } - return import('@auth0/auth0-spa-js').then(({default: createAuth0Client}) => + return import('@auth0/auth0-spa-js').then(({createAuth0Client}) => createAuth0Client({ domain: env.VITE_PUBLIC_AUTH0_DOMAIN, - client_id: env.VITE_PUBLIC_AUTH0_CLIENT_ID, - redirect_uri: `${window.location.protocol}//${window.location.host}`, - audience: env.VITE_PUBLIC_AUTH0_AUDIENCE, + clientId: env.VITE_PUBLIC_AUTH0_CLIENT_ID, + authorizationParams: { + redirect_uri: `${window.location.protocol}//${window.location.host}`, + audience: env.VITE_PUBLIC_AUTH0_AUDIENCE, + }, cacheLocation: 'localstorage', }), ); diff --git a/apps/codeimage/src/state/auth/auth0.ts b/apps/codeimage/src/state/auth/auth0.ts index ce77a0bf2..41580f72d 100644 --- a/apps/codeimage/src/state/auth/auth0.ts +++ b/apps/codeimage/src/state/auth/auth0.ts @@ -27,12 +27,18 @@ export function $auth0State() { } async function login() { - auth0.loginWithRedirect({connection: 'github'}); + auth0.loginWithRedirect({ + authorizationParams: { + connection: 'github', + }, + }); } async function signOut() { await auth0.logout({ - returnTo: `${window.location.protocol}//${window.location.host}`, + logoutParams: { + returnTo: `${window.location.protocol}//${window.location.host}`, + }, }); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bf404f76b..be059c321 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -125,7 +125,7 @@ importers: apps/codeimage: specifiers: - '@auth0/auth0-spa-js': 1.22.5 + '@auth0/auth0-spa-js': ^2.0.0 '@codeimage/api': workspace:* '@codeimage/atomic-state': workspace:* '@codeimage/config': workspace:* @@ -209,7 +209,7 @@ importers: workbox-strategies: ^6.5.4 workbox-window: ^6.5.4 dependencies: - '@auth0/auth0-spa-js': 1.22.5 + '@auth0/auth0-spa-js': 2.0.0 '@codeimage/api': link:../api '@codeimage/atomic-state': link:../../packages/atomic-state '@codeimage/config': link:../../packages/config @@ -636,16 +636,8 @@ packages: grapheme-splitter: 1.0.4 dev: true - /@auth0/auth0-spa-js/1.22.5: - resolution: {integrity: sha512-6gaQcd+Eb8ZBcdQkrrm9undM7dY/rPvVdQN8s7rxxrviUCs7OopEygsfSkHf67IP4HtlCiE8dSW5/AipRUOw/A==} - dependencies: - abortcontroller-polyfill: 1.7.5 - browser-tabs-lock: 1.2.15 - core-js: 3.25.5 - es-cookie: 1.3.2 - fast-text-encoding: 1.0.6 - promise-polyfill: 8.2.3 - unfetch: 4.2.0 + /@auth0/auth0-spa-js/2.0.0: + resolution: {integrity: sha512-qHArgvA+ltI37g1vo3q7XtWxhMNAyL0LrnwCKCHQ1uzMWnxhdyxi2w9/BXfp1c+2L1Zc+DDh3XhpbYVXNhvadg==} dev: false /@babel/code-frame/7.18.6: @@ -5249,10 +5241,6 @@ packages: event-target-shim: 5.0.1 dev: false - /abortcontroller-polyfill/1.7.5: - resolution: {integrity: sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ==} - dev: false - /abstract-logging/2.0.1: resolution: {integrity: sha512-2BjRTZxTPvheOvGbBslFSYOUkr+SjPtOnrLP33f+VIWLzezQpZcqVg7ja3L4dBXmzzgwT+a029jRx5PCi3JuiA==} dev: false @@ -5713,13 +5701,6 @@ packages: dependencies: wcwidth: 1.0.1 - /browser-tabs-lock/1.2.15: - resolution: {integrity: sha512-J8K9vdivK0Di+b8SBdE7EZxDr88TnATing7XoLw6+nFkXMQ6sVBh92K3NQvZlZU91AIkFRi0w3sztk5Z+vsswA==} - requiresBuild: true - dependencies: - lodash: 4.17.21 - dev: false - /browserify-zlib/0.1.4: resolution: {integrity: sha512-19OEpq7vWgsH6WkvkBJQDFvJS1uPcbFOQ4v9CU839dO+ZZXUZO6XpE6hNCqvlIIj+4fZvRiJ6DsAQ382GwiyTQ==} dependencies: @@ -6264,11 +6245,6 @@ packages: browserslist: 4.21.4 dev: true - /core-js/3.25.5: - resolution: {integrity: sha512-nbm6eZSjm+ZuBQxCUPQKQCoUEfFOXjUZ8dTTyikyKaWrTYmAVbykQfwsKE5dBK88u3QCkCrzsx/PPlKfhsvgpw==} - requiresBuild: true - dev: false - /core-util-is/1.0.3: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} dev: true @@ -6725,10 +6701,6 @@ packages: string.prototype.trimstart: 1.0.5 unbox-primitive: 1.0.2 - /es-cookie/1.3.2: - resolution: {integrity: sha512-UTlYYhXGLOy05P/vKVT2Ui7WtC7NiRzGtJyAKKn32g5Gvcjn7KAClLPWlipCtxIus934dFg9o9jXiBL0nP+t9Q==} - dev: false - /es-shim-unscopables/1.0.0: resolution: {integrity: sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==} dependencies: @@ -7524,10 +7496,6 @@ packages: /fast-safe-stringify/2.1.1: resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} - /fast-text-encoding/1.0.6: - resolution: {integrity: sha512-VhXlQgj9ioXCqGstD37E/HBeqEGV/qOD/kmbVG8h5xKBYvM1L3lR1Zn4555cQ8GkYbJa8aJSipLPndE1k6zK2w==} - dev: false - /fast-uri/2.1.0: resolution: {integrity: sha512-qKRta6N7BWEFVlyonVY/V+BMLgFqktCUV0QjT259ekAIlbVrMaFnFLxJ4s/JPl4tou56S1BzPufI60bLe29fHA==} dev: false @@ -10509,10 +10477,6 @@ packages: optional: true dev: true - /promise-polyfill/8.2.3: - resolution: {integrity: sha512-Og0+jCRQetV84U8wVjMNccfGCnMQ9mGs9Hv78QFe+pSDD3gWTpz0y+1QCuxy5d/vBFuZ3iwP2eycAkvqIMPmWg==} - dev: false - /promise-retry/2.0.1: resolution: {integrity: sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==} engines: {node: '>=10'} @@ -12161,10 +12125,6 @@ packages: through: 2.3.8 dev: true - /unfetch/4.2.0: - resolution: {integrity: sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==} - dev: false - /unicode-canonical-property-names-ecmascript/2.0.0: resolution: {integrity: sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==} engines: {node: '>=4'}