Headless Integration
The headless integration allows you to perform identity verification programmatically without requiring users to be redirected away from your application. This is perfect for single-page applications, mobile apps, or any scenario where you want to maintain full control over the user experience.Overview
Instead of redirecting users to complete OAuth flow, the headless integration:- Creates an authorization request via API
- Opens a popup window for user authentication
- Polls for completion while user completes verification in popup
- Automatically closes popup and returns identity data
- Provides idv_rec for subsequent verification calls
Implementation
You’ll need your program API key from the admin dashboard to use the headless flow.
Framework Examples
React Hook
Vue 3 Composable
Next.js App Router
Security Considerations
Client-Side Implementation
For client-side applications, create API routes that proxy requests:Rate Limiting
The API includes rate limiting to prevent abuse:- Authorization requests: 10 per minute per API key
- Status checks: 30 per minute per API key
Troubleshooting
Common Issues
Popup Blocked- Ensure the authorization is triggered by a user action (click)
- Check browser popup settings
- Consider showing a message about allowing popups
- Authorization requests expire after 15 minutes
- Implement proper error handling for expired requests
- Consider shortening your polling timeout
- Verify your API key is correct and from the right environment
- Ensure the associated program is active
- Check that you’re using Bearer token format:
Bearer pk_...
Debug Mode
Enable debug logging in development:Migration from Redirect Flow
If you’re migrating from the traditional redirect-based flow:Before (Redirect)
After (Headless)
- No page reload - maintain application state
- Better UX - users stay on your site
- Mobile friendly - works well on all devices
- Customizable - full control over UI and error handling
Best Practices
- Always handle errors gracefully - network issues, popup blocking, etc.
- Implement proper loading states - show progress during authorization
- Use exponential backoff - for status polling to avoid rate limits
- Keep API keys secure - never expose them client-side
- Test thoroughly - across different browsers and devices
- Monitor usage - track authorization success rates and failure modes