Skip to content

Commit

Permalink
Revert "feat: Use Magic OAuth V2 to log in (#121)" (#122)
Browse files Browse the repository at this point in the history
This reverts commit 336d03b.
  • Loading branch information
LautaroPetaccio authored Nov 1, 2024
1 parent 336d03b commit 0458fba
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 28 deletions.
25 changes: 4 additions & 21 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
"@dcl/schemas": "^9.8.0",
"@dcl/single-sign-on-client": "^0.1.0",
"@dcl/ui-env": "^1.4.0",
"@magic-ext/oauth": "^22.16.0",
"@magic-ext/oauth2": "^9.16.0",
"@magic-ext/oauth": "^15.1.1",
"@well-known-components/fetch-component": "^2.0.2",
"ajv": "^8.12.0",
"classnames": "^2.3.2",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Pages/CallbackPage/CallbackPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ export const CallbackPage = () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/naming-convention
const { OAuthExtension } = await import('@magic-ext/oauth2')
const { OAuthExtension } = await import('@magic-ext/oauth')

const magic = new Magic(MAGIC_KEY, {
extensions: [new OAuthExtension()]
})

try {
setConnectionModalState(ConnectionModalState.VALIDATING_SIGN_IN)
await magic?.oauth2.getRedirectResult()
await magic?.oauth.getRedirectResult()
setConnectionModalState(ConnectionModalState.WAITING_FOR_CONFIRMATION)
} catch (error) {
console.log(error)
Expand Down
6 changes: 3 additions & 3 deletions src/components/Pages/LoginPage/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { OAuthProvider } from '@magic-ext/oauth2'
import { OAuthProvider } from '@magic-ext/oauth'
import { ethers } from 'ethers'
import { AuthIdentity, Authenticator } from '@dcl/crypto'
import { ProviderType } from '@dcl/schemas/dist/dapps/provider-type'
Expand Down Expand Up @@ -57,15 +57,15 @@ export async function connectToProvider(connectionOption: ConnectionOptionType):
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/naming-convention
const { OAuthExtension } = await import('@magic-ext/oauth2')
const { OAuthExtension } = await import('@magic-ext/oauth')
const magic = new Magic(MAGIC_KEY, {
extensions: [new OAuthExtension()]
})

const url = new URL(window.location.href)
url.pathname = '/auth/callback'

await magic?.oauth2.loginWithRedirect({
await magic.oauth.loginWithRedirect({
provider: connectionOption === ConnectionOptionType.X ? 'twitter' : (connectionOption as OAuthProvider),
redirectURI: url.href
})
Expand Down

0 comments on commit 0458fba

Please sign in to comment.