Recommended Setup
Production-ready Reclaim Protocol integration with secure backend initialization
✅ Production-Ready Approach
This is the recommended way to integrate Reclaim Protocol in production applications. Your APP_SECRET stays secure on your backend, never exposed to the client.
SDK Installation Required
You need to install the appropriate SDK for your backend:
-
Node.js/JavaScript: Install
@reclaimprotocol/js-sdk -
Python: Install
reclaim-python-sdk
Each setup guide below includes detailed installation instructions.
Overview
The recommended setup separates sensitive operations (SDK initialization with APP_SECRET) from client-side operations (UI and proof display). This architecture ensures:
- ✅ APP_SECRET stays secure - Never exposed in browser code
- ✅ Backend verification - Proofs are verified server-side before use
- ✅ Scalability - Centralized configuration management
- ✅ Auditability - All verifications logged on your server
Architecture
How It Works
Step 1: Backend Initialization (Secure)
Your backend initializes the SDK with APP_SECRET from environment variables:
Step 2: Generate Configuration
Backend generates a configuration object that's safe to send to the frontend:
Step 3: Frontend Reconstruction
Frontend receives the config and reconstructs the proof request:
Step 4: Backend Verification
When the user completes verification, Reclaim sends the proof to your callback URL:
Security Best Practices
Critical Security Requirements
- Never expose APP_SECRET - Always keep it on the backend in environment variables
- Use HTTPS - All production deployments must use HTTPS
- Verify proofs backend-side - Never trust client-side verification alone
- Set callback URL - Let Reclaim send proofs directly to your server
- Validate proof structure - Check all required fields before processing
- Use environment variables - Never hardcode credentials
Environment Setup
.env File (Backend Only)
.gitignore
Ensure credentials are never committed:
Implementation by Framework
Choose your backend framework to see detailed implementation:
Node.js / Express
Express.js backend with React frontend
Next.js
Full-stack Next.js with API routes
Python
FastAPI or Django implementation
Key API Endpoints
1. Generate Config Endpoint
Purpose: Securely initialize SDK and return safe config to frontend
Response:
2. Receive Proofs Endpoint (Callback)
Purpose: Receive and verify proofs from Reclaim Protocol
Request Body: URL-encoded proof object
Response: 200 OK if verification succeeds
Local Development with ngrok
When developing locally, you need a public URL for the callback endpoint:
Install ngrok
Start ngrok Tunnel
You'll see output like:
Update Your .env
ngrok Tip: The free tier generates a new URL each time. Consider using the paid tier for a persistent domain during development, or use ngrok's configuration to set a custom subdomain.
Testing the Integration
1. Test Config Generation
Should return:
2. Test Callback Endpoint
You can manually test the callback with a mock proof:
Error Handling
Backend Initialization Errors
Proof Verification Errors
Production Checklist
Before deploying to production:
- APP_SECRET is in environment variables (never in code)
- .env file is in .gitignore
- HTTPS is enabled for all endpoints
- Callback URL is publicly accessible
- Backend verifies all proofs before processing
- Error handling is implemented
- Logging is set up for audit trail
- Rate limiting is configured
- Database stores verification results
- User sessions/authentication is integrated
Next Steps
-
Choose your framework and follow the detailed guide:
-
Backend Verification → - Deep dive into proof verification
-
API Reference → - Complete SDK documentation
-
Advanced Configuration → - Modal customization, callbacks, parameters, and more