- Widget: A plug-and-play widget that handles UI/State management for you. Find an example here
- Session API: A react hook that gives you total control of the user journey and UI/State management. Find an example here.
Install
IDKitWidget
First, add theIDKitWidget component to your site. The values for the app_id and action props were obtained from the Developer Portal in Getting Started. We’ll define the handleVerify and onSuccess callbacks next.
/verify.tsx
handleVerify
ThehandleVerify callback is called when the user’s proof is received. This will send the proof to your backend for verification:
/verify.tsx
Verifying the proof
ThehandleVerify callback sends the proof to your backend for verification. In the backend handler should verify the proof with the Developer Portal API:
The call to the Developer Portal API must be made server-side to avoid man in
the middle attacks.
/api/verify.ts
If you want to verify the proof onchain read more about it here.
onSuccess
TheonSuccess callback is called when the user closes the modal. This is where you can perform any necessary actions, such as redirecting the user to a new page.
/verify.tsx
Session Hook
First, setup the session hook with your configuration:/verify.tsx
- WaitingForConnection: Display the
sessionURIto the user eg. with a QR code - Confirmed: Session ended successfully, now you must verify the
resultproof in your backend. - Failed: Session failed, check
errorCode