This examples runs the basic create session in backend -> frontId -> backID -> processId -> Selfie -> finish status in backend flow, the code is simple enough to insert or remove any step for testing or creating proof of concepts.
Vite requires Node.js version 14.18+, 16+. some templates require a higher Node.js version to work, please upgrade if your package manager warns about it.
Run npm install
Copy .env.example to .env.local and add your local values
VITE_API_URL=https://demo-api.incodesmile.com/0
VITE_SDK_URL=https://sdk.incode.com/sdk/onBoarding-1.80.1.js
VITE_CONSENT_ID=
# HERE ONLY FOR DEMO PURPOSES, THE APIKEY AND THE FLOW_ID SHOULD NEVER BE IN THE FRONTEND.
VITE_FAKE_BACKEND_APIURL=https://demo-api.incodesmile.com
VITE_FAKE_BACKEND_APIKEY=
VITE_FAKE_BACKEND_FLOW_ID=
Remember the Flow holds the backend counter part of the process, some configurations there might affect the behavior of the WebSDK here.
Starting and Finishing the session must be done in the backend, to simplify development this sample includes a fake_backend.js file that does this in the frontend, please be advised to replace this with a proper backend for your production runs. the APIKEY should never be exposed in the frontend.
Vite is configured to serve the project using https and and expose him self, so you can easily test with your mobile phone on the local network.
run npm run dev
A new server will be exposed, the data will be in the terminal
run npm run build
A new build will be created in /dist you can serve that build everywhere just remember to serve with https.
You can save the specific version needed under /public and change the VITE_SDK_URL variable on .env.local to something like:
VITE_SDK_URL=/name-of-the-js-file.js