Use sumsub web SDK for KYC form without access token generation #1
10
src/App.tsx
10
src/App.tsx
@ -16,8 +16,12 @@ function App() {
|
||||
<WalletConnectProvider>
|
||||
<Routes>
|
||||
<Route path="/" element={<ConnectWallet />} />
|
||||
<Route
|
||||
path="/user-verification"
|
||||
element={<UserVerification />}
|
||||
></Route>
|
||||
<Route element={<SignPageLayout />}>
|
||||
<Route path="/sign-with-nitro-key" element={<SignWithNitroKey />} />
|
||||
<Route path="/sign-with-nitro-key/:userId" element={<SignWithNitroKey />} />
|
||||
<Route
|
||||
path="/sign-with-cosmos/:cosmosAddress/:ethSignature"
|
||||
element={<SignWithCosmos />}
|
||||
@ -26,10 +30,6 @@ function App() {
|
||||
path="/onboarding-success/:cosmosAddress"
|
||||
element={<OnboardingSuccess />}
|
||||
></Route>
|
||||
<Route
|
||||
path="/user-verification"
|
||||
element={<UserVerification />}
|
||||
></Route>
|
||||
</Route>
|
||||
<Route path="*" element={<PageNotFound />} />
|
||||
</Routes>
|
||||
|
@ -1,14 +1,18 @@
|
||||
import React from 'react'
|
||||
import React, { useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import { Box, Typography } from '@mui/material'
|
||||
import SumsubWebSdk from '@sumsub/websdk-react'
|
||||
|
||||
|
||||
const UserVerification = () => {
|
||||
|
||||
const [userId, setUserId] = useState<String>('');
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const config = {
|
||||
lang: "en", //language of WebSDK texts and comments (ISO 639-1 format)
|
||||
// email: applicantEmail,
|
||||
// phone: applicantPhone,
|
||||
theme: "light",
|
||||
}
|
||||
|
||||
@ -17,15 +21,31 @@ const UserVerification = () => {
|
||||
adaptIframeHeight: true
|
||||
}
|
||||
|
||||
// TODO: Implement
|
||||
const accessTokenExpirationHandler = async () => {
|
||||
alert("Please renew token");
|
||||
return "Token expired";
|
||||
}
|
||||
|
||||
const accessToken = {
|
||||
"token": process.env.REACT_APP_SUMSUB_TOKEN,
|
||||
"token": process.env.REACT_APP_SUMSUB_TOKEN!,
|
||||
"userId": "deepstack1234"
|
||||
}
|
||||
|
||||
const messageHandler = (event: any, payload: any ) => {
|
||||
if (event === 'idCheck.onApplicantLoaded'){
|
||||
setUserId(payload.applicantId)
|
||||
}
|
||||
|
||||
if (event === 'idCheck.onApplicantSubmitted'){
|
||||
console.log('Application is submitted');
|
||||
navigate(`/sign-with-nitro-key/${userId}`);
|
||||
}
|
||||
|
||||
console.log(event);
|
||||
console.log("Payload is ", payload);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box
|
||||
@ -46,6 +66,7 @@ const UserVerification = () => {
|
||||
expirationHandler={accessTokenExpirationHandler}
|
||||
config={config}
|
||||
options={options}
|
||||
onMessage={messageHandler}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user