Guide
Integration HelpBest practices for OID4VP integration in React Native
AL
Alex Chen
about 2 months ago
374
7
I'm implementing OID4VP verification in a React Native app and wanted to share some best practices I've learned.
## The Challenge
Mobile apps have unique constraints:
- Deep linking for wallet interactions
- Handling app backgrounding during verification
- QR code scanning UX
## My Approach
### 1. Universal Links for Callbacks
Instead of custom URL schemes, use universal links:
```typescript
// Configure universal links in app.json
{
"expo": {
"ios": {
"associatedDomains": ["applinks:yourapp.com"]
}
}
}
```
### 2. State Management
Use a verification context to track session state:
```typescript
const VerificationContext = createContext<{
sessionId: string | null;
status: 'idle' | 'pending' | 'success' | 'failed';
startVerification: () => Promise<void>;
}>({...});
```
### 3. QR Code Display
For desktop-to-mobile flows, generate the QR on the server:
```typescript
const { qrCode, sessionId } = await credlyr.verifications.create({
policyId: 'pol_age_verification',
format: 'qr',
});
```
## Questions
Has anyone implemented this differently? I'm particularly curious about handling the case where the wallet app isn't installed.