Usage
Implement Reclaim verification flows in your web application
Overview
This guide demonstrates how to implement complete verification flows in your web application, including initialization, event handling, UI states, and error management.
Prerequisites
- ✅ Completed Installation
- ✅ Completed Setup
- ✅ Extension installed and extension ID configured
- ✅ API credentials from API Key guide
Basic Implementation
Simple Verification Flow
The simplest implementation triggers verification and handles the result:
SDK API Reference
Initialization Methods
reclaimExtensionSDK.init()
Initialize a new verification request with credentials.
Parameters:
appId(string): Your application ID from Reclaim dashboardappSecret(string): Your application secret (keep secure!)providerId(string): ID of the provider to verify (e.g.,"google-login")options(object): Configuration optionsextensionID(string): Required - Browser extension ID
Returns: Promise that resolves to a ReclaimRequest object
reclaimExtensionSDK.fromConfig()
Initialize from a pre-generated configuration (recommended for production).
Parameters:
requestConfig(object): Configuration object from backendoptions(object): Configuration optionsextensionID(string): Required - Browser extension ID
Returns: ReclaimRequest object
Use Case: When using server-side request generation for better security
reclaimExtensionSDK.isExtensionInstalled()
Check if the Reclaim extension is installed in the user's browser.
Parameters:
options(object): Configuration optionsextensionID(string): Required - Browser extension ID
Returns: Promise that resolves to true if installed, false otherwise
Use Case: Check extension status before starting verification to show appropriate UI
reclaimExtensionSDK.getVersion()
Get the current version of the Reclaim Extension SDK.
Parameters: None
Returns: String containing the SDK version (e.g., "1.0.0")
Use Case:
- Display SDK version in your application
- Log version information for debugging
- Check SDK version for compatibility
Request Object Methods
After calling reclaimExtensionSDK.init() or fromConfig(), you receive a request object with these methods:
request.setAppCallbackUrl()
Set a callback URL where proofs will be sent automatically.
Parameters:
url(string): Your backend endpoint to receive proofs
Use Case: Automatically send proofs to your server when verification completes
request.setParams()
Add custom parameters to the verification request.
Parameters:
params(object): Custom key-value pairs to include with the proof
Use Case: Pass additional context or metadata with the verification
request.addContext()
Add context information to the verification.
Parameters:
address(string): Context address or identifiermessage(string): Context message or description
Use Case: Add on-chain context or additional verification metadata
request.startVerification()
Start the verification process and return a promise that resolves with proofs.
Returns: Promise that resolves with proof data when verification completes
Use Case:
- Get proofs via promise instead of event listeners
- Use with async/await for cleaner code flow
- Combine with event listeners for both immediate and async handling
Note: You can use both the promise return value AND event listeners together. The completed event will fire, and the promise will resolve with the same proof data.
request.on()
Register event listeners for verification lifecycle events.
Parameters:
event(string): Event name ("started","completed", or"error")callback(function): Function to call when event fires
Available Events:
started: Fired when verification session begins (payload:{ sessionId })completed: Fired when verification succeeds (payload:proofsobject)error: Fired when verification fails or is cancelled (payload:errorobject/string)
Complete Usage Example
React Implementation
Complete React Component
Production-ready React component with full state management:
CSS Styling
Custom Hook (React)
Create a reusable hook for verification:
Using the Custom Hook
Multiple Provider Support
Handle multiple providers in your application:
Testing Your Integration
Local Testing Checklist
- ✅ Extension installed and active
- ✅ Environment variables configured
- ✅ Extension ID matches installed extension
- ✅ Backend API endpoints working (if using server config)
- ✅ Error handling works for all scenarios
- ✅ UI updates correctly during verification flow
Debug Logging
Enable debug mode for development:
Next Steps
- Troubleshooting - Common issues and solutions
- Backend Validation - Implement server-side proof verification
- User Experience - Optimize verification flow for your users