Next.js
This guide walks you through integrating OneSDK with Next.js, providing you with a solid foundation for building secure and efficient KYC workflows.
Quick Start Video
Setup Instructions
Implementation Guide
1. Create OneSDK Hook
Create a new file hooks/useOneSDK.js
:
2. Create End-to-End Component
Create a new component file components/EndToEnd.js
:
3. Add Component to Page
Update your page file (e.g., app/page.js
):
Component Configuration
Welcome Form
Document Form
Biometrics
Event Handling
Form Events
Biometrics Events
Best Practices
Always implement proper error handling for both SDK initialization and component events.
Show appropriate loading states during initialization and between component transitions.
Properly clean up event listeners when components unmount to prevent memory leaks.
Never expose credentials in client-side code. Use environment variables and server-side token generation.
Remember to handle cleanup in your components by implementing proper unmounting logic and removing event listeners when components are destroyed.
Troubleshooting
Common Issues
- SDK Initialization Failed: Check your credentials and network connection
- Component Mount Errors: Ensure the container element exists in the DOM
- Event Handler Issues: Verify event names and handler implementations