Choose Your Integration
Redirect Flow
Redirect users to OFAuth’s authentication pages. Simple to implement.
Popup Flow
Show authentication in a popup. Best user experience.
How It Works
- Create a Link session with your redirect URL
- Redirect the user to OFAuth’s secure authentication page
- User authenticates on OFAuth (2FA and captcha handled automatically)
- Receive Connection ID via callback URL or webhook
Prerequisites
Get API Key
Get your API key from OFAuth Dashboard > Developers > API Keys
Configure Redirect URI
Add your callback URL to Allowed Redirect URIs in Dashboard > Developers > API
Redirect Flow
The simplest integration—redirect users to OFAuth’s hosted authentication pages.Step 1: Create a Link Session
Session Options
| Option | Type | Description |
|---|---|---|
redirectUrl | string | Callback URL (must be in Allowed Redirect URIs) |
clientReferenceId | string | Your internal user ID for correlation |
connectionId | string | Existing connection ID to reconnect |
Step 2: Redirect User
Step 3: Handle the Callback
After authentication, users are redirected to your URL:Callback Parameters
| Parameter | Description |
|---|---|
status | success, cancelled, or error |
connection_id | The connection ID (on success) |
client_reference_id | Your internal ID (if provided) |
step | Where user cancelled: pre-login, login, 2fa |
error_code | Error type: session_expired, invalid_credentials, account_locked, 2fa_failed |
Popup Flow (Embed Library)
Keep users in your app with a popup authentication experience.Installation
JavaScript Library Usage
Configuration Options
| Option | Type | Description |
|---|---|---|
theme | 'light' | 'dark' | 'auto' | Theme for the interface (default: ‘auto’) |
onSuccess | (metadata) => void | Called when authentication succeeds |
onClose | (metadata) => void | Called when user closes the embed |
onInvalidSession | () => void | Called when session expires |
Success Metadata
Global Script (No Build)
Use the Connection
Once you have a Connection ID, make API calls:Reconnecting Expired Connections
When a connection expires, reconnect without creating duplicates:Security Best Practices
Server-Side Verification
Always verify session status server-side, never trust client-side data
HTTPS Only
Use HTTPS for all redirect URLs and API communications
Session Expiry
Link sessions expire after 1 hour. Create a new session if expired.
Allowed URIs
Configure exact redirect URLs in your dashboard. No wildcards.
Troubleshooting
Session Expired
Session Expired
Link sessions expire after 1 hour. Create a new session with
/v2/link/init.Invalid Redirect URL
Invalid Redirect URL
Add the URL to Allowed Redirect URIs in Dashboard > Developers > API.
Popup Blocked
Popup Blocked
Ensure the popup is triggered by a user action (click event), not automatically.
CSP/CORS Issues (Embed)
CSP/CORS Issues (Embed)
Add your domain to Allowed Origins in the OFAuth dashboard.