How UIP Authentication Works
UIP uses a simple two-path UX based on the user’s device. Your application detects the device type and shows the appropriate interface:Desktop Flow
Display the QR code image returned by the API. The user scans it with their UIP app to complete verification.
Mobile Flow
Display an “Open UIP” button that deep links into the UIP app. No QR code scanning needed on mobile.
Implementation Flow
Create a Session
Call
POST /v1/identify or POST /v1/sign with your intent. The API returns a session_id, qr_code (base64 PNG data URI), and expires_at.Display QR Code (Desktop) or Deep Link (Mobile)
Desktop: Display the
qr_code from the API response as an image. It is a base64-encoded PNG data URI that you can use directly as an <img> src.Mobile: Display an “Open UIP” button linking to https://www.uip.id/{session_id}. This deep links into the UIP app.Poll for Completion
Poll
GET /v1/identify/:id (or GET /v1/sign/:id) every 2-3 seconds. When the status changes to completed, all verified data is included in the response.No webhooks needed for Identify and Sign. The polling flow is the primary integration pattern. Webhooks are only used for the Message API and Authorize API.
Future SDK: A client-side SDK is planned that will handle device detection, QR rendering, and polling automatically. For now, implement this logic in your application.
QR Code Details
Theqr_code field in the API response is a base64-encoded PNG data URI. It encodes a URL in the format https://www.uip.id/{session_id}.
Using the QR Code
Using the QR Code
The QR code is ready to use directly as an image source:You do not need to generate your own QR code — the API provides it.
Deep Link URL
Deep Link URL
For mobile users, construct the deep link URL from the session ID:This URL opens the UIP app directly with the session details.
QR Code Display Best Practices
Size and Positioning
Size and Positioning
- Minimum size: 200x200 pixels for reliable scanning
- Recommended: 256x256 to 300x300 pixels
- Center the QR code prominently on the page
- Add adequate white space (quiet zone) around the QR code
Visual Feedback
Visual Feedback
- Show loading indicator while waiting for scan
- Display clear instructions: “Scan with UIP app”
- Add animated elements to draw attention to the QR code
- Show a countdown timer for session expiration
Error States
Error States
- Handle expired sessions gracefully (5-minute expiry)
- Show “Try Again” button to generate a new session
- Display clear error messages for connection issues
- Provide fallback options if QR scanning fails
Accessibility
Accessibility
- Provide alt text for screen readers
- Include text instructions alongside QR code
- Ensure sufficient color contrast for visibility
- Consider alternative authentication methods for accessibility
Session Management
Session Expiration
Sessions expire after 5 minutes. Always check expiration status and generate new sessions as needed. Show a timer to the user.
One-Time Use
Each session is single-use. After the user completes verification, the session cannot be reused.
HTTPS Required
All UIP integrations must use HTTPS in production to prevent man-in-the-middle attacks.
Concurrent Sessions
Support multiple concurrent sessions for users authenticating from different tabs or devices.
Updating the Frontend
Use WebSockets, Server-Sent Events, or short polling from your frontend to detect when the backend receives a completed result.WebSockets
Best for real-time bidirectional communication. Ideal for dashboards and interactive applications.
Server-Sent Events
Simple one-way updates from server to client. Perfect for status updates and notifications.
Short Polling
Poll your own backend every 2-3 seconds. Simple and works everywhere as a fallback.
Testing QR Flows
Test Device Detection
Verify your device detection logic shows QR codes on desktop and deep link buttons on mobile
Next Steps
Quickstart
Build your first integration with working code
Identify API
Full API reference for authentication
Error Handling
Handle errors gracefully