Frontend Example
This guide will walk you through the fundamental steps to integrate Reclaim's proof verification system into your React application.
Prerequisites
Before implementing Reclaim verification in your React application, ensure you have:
- Successfully installed the Reclaim SDK (refer to the Installation Guide)
- Obtained your credentials from the Reclaim Developer Portal:
- Application ID
- Application Secret
- Provider ID
โ ๏ธ Security Critical: Your Application Secret must be kept secure and should never be exposed in client-side code. Store it securely on your backend server.
Implementation Guide
The following example demonstrates how to create a React component that implements Reclaim verification with QR code functionality:
Implementation Breakdown
1. Component Architecture
The component is structured around three main elements:
- State management for verification URL and proofs
- Verification request handling
- User interface rendering
2. Verification Process Flow
a. Initialization
- User triggers verification by clicking the button
- SDK initializes with your credentials
- Request URL is generated and stored in state
b. Session Management
- Component begins monitoring for proof submissions
- Handles both success and error scenarios
- Supports multiple response formats (string and object)
c. User Interface
- Displays verification button
- Shows QR code when URL is available
- Presents verification results
3. Response Handling
The component handles two types of proof responses:
- String responses (when using custom callback URLs)
- Object responses (when using default callback URL)
Integration Steps
- Component Integration
- Environment Setup
- Store your credentials securely
- Configure error handling
- Set up appropriate loading states
๐ก Device Detection Tip: Consider implementing device detection to optimize the user experience:
- Desktop: Display QR code for mobile scanning
- Mobile: Show direct verification link
๐ Production Security Requirements:
- Never expose APP_SECRET in frontend code
- Generate request configurations server-side
- Use
fromJsonString()
method in frontend code - Implement proper error handling and validation
Refer to the Fullstack Example for secure implementation details.
Next Steps
After implementing the basic verification:
-
Advanced Configuration
- Explore Advanced Configuration Options
- Customize SDK behavior for your use case
-
Optimization
- Review Best Practices
- Implement proper error handling
- Add loading states and user feedback
-
Testing
- Test across different devices and browsers
- Verify error scenarios
- Validate security measures
Support Resources
- View complete working example: demo repository
- Join our Telegram community for support
- Consult the API documentation for detailed reference
Remember to regularly update your implementation as new SDK versions are released to ensure optimal security and performance.