Skip to content

Commit

Permalink
feat: update auth0 (#396)
Browse files Browse the repository at this point in the history
* chore(app): update auth0 dependency to 2.0.0
* docs(changeset): update auth0 to 2.0.0
  • Loading branch information
riccardoperra authored Nov 12, 2022
1 parent c6f16a1 commit c4b24b1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 51 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-boxes-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@codeimage/app': patch
---

update auth0 to 2.0.0
2 changes: 1 addition & 1 deletion apps/codeimage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:*",
Expand Down
10 changes: 6 additions & 4 deletions apps/codeimage/src/core/constants/auth0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ function createAuth0(): Promise<Auth0Client> {
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',
}),
);
Expand Down
10 changes: 8 additions & 2 deletions apps/codeimage/src/state/auth/auth0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
},
});
}

Expand Down
48 changes: 4 additions & 44 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c4b24b1

Please sign in to comment.