Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoaidanh committed Oct 16, 2023
1 parent b54a745 commit 99a8a0e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@blocto/web3-react-connector": "^1.0.0",
"@coinbase/wallet-sdk": "^3.0.4",
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@kybernetwork/oauth2": "1.0.1-rc.4",
"@kybernetwork/oauth2": "1.0.1-rc.5",
"@kyberswap/krystal-walletconnect-v2": "0.0.1",
"@kyberswap/ks-sdk-classic": "^1.0.3",
"@kyberswap/ks-sdk-core": "1.0.11",
Expand Down
10 changes: 9 additions & 1 deletion src/pages/Oauth/AuthForm/EmailLoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,15 @@ const EmailLoginForm = ({ flowStatus }: { flowStatus: FlowStatus }) => {

const qs = useParsedQueryString<{ flow: string }>()
const onSendCode = async ({ email }: { email: string }) => {
return KyberOauth2.oauthUi.sendVerifyCode({ email, flow: qs.flow + '' })
return KyberOauth2.oauthUi.sendVerifyCode(
{ email, flow: qs.flow + '' },
{
withCredentials: true,
headers: {
'X-CSRF-Token': window.csrf,
},
},
)
}

return (
Expand Down
1 change: 1 addition & 0 deletions src/pages/Oauth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export function Login() {

const connectingWallet = useRef(false)

window.csrf = authFormConfig?.ui?.nodes?.find(e => e.attributes.name === 'csrf_token')?.attributes?.value ?? ''
const signInWithEth = useCallback(async () => {
try {
const siweConfig = authFormConfig?.oauth_client?.metadata?.siwe_config
Expand Down
1 change: 1 addition & 0 deletions src/react-app-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ interface Window {
solana?: any
recaptchaOptions?: any
zESettings?: any
csrf: string // todo
}

declare module 'content-hash' {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2257,10 +2257,10 @@
bs58 "^5.0.0"
uuid "^8.3.2"

"@kybernetwork/oauth2@1.0.1-rc.4":
version "1.0.1-rc.4"
resolved "https://npm.pkg.github.com/download/@kybernetwork/oauth2/1.0.1-rc.4/954d9fd7699ac79bcce1a91a5159e451b98d3ed9#954d9fd7699ac79bcce1a91a5159e451b98d3ed9"
integrity sha512-word23WbqARrHIAR/JStAvSdmupQZC07k8xCU2VidRjeT2nhLxvi+4j/FLBKwzLvgObvBHnqDCqbr9D434qjXQ==
"@kybernetwork/oauth2@1.0.1-rc.5":
version "1.0.1-rc.5"
resolved "https://npm.pkg.github.com/download/@kybernetwork/oauth2/1.0.1-rc.5/9a727733fbe5a48ea2a6d4bbb49e87dc62fd95c7#9a727733fbe5a48ea2a6d4bbb49e87dc62fd95c7"
integrity sha512-jukcpMG++loxTEDOs9fhuKyGCiasO8AhSsLPpNKxQ0j5L9T050YEvcZz7rn1V89FM+J9IKL7i+mLRPUz9KxShg==
dependencies:
axios "1.2.1"
client-oauth2 "^4.3.3"
Expand Down

0 comments on commit 99a8a0e

Please sign in to comment.