Using Node.js? Our TypeScript SDK provides wrapper methods for Link authentication with built-in error handling.
Prerequisites
1
OFAuth API Key
Get your API key from the OFAuth Dashboard
2
Configure Redirect URI
Add your callback URL to Allowed Redirect URIs in Dashboard → Developers → API
3
Configure User Data Permissions
Select which OnlyFans data your platform can access in Dashboard → Developers → API → User Data Permissions
Connection Flow
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
Send the user to theurl from Step 1:
- Enter their OnlyFans credentials
- Complete 2FA if enabled (handled automatically)
- Solve captcha challenges (handled automatically)
Step 3: Handle the Callback
After authentication, users are redirected to your URL with query parameters: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 |
Step 4: Use the Connection
Make API calls with the connection ID:Integration Options
| Option | Best For | Guide |
|---|---|---|
| Redirect | Simple setup, server-rendered apps | This page |
| Embed Popup | Best UX, stays in your app | Link Embed |
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.
Billing
You’re only charged for active connections. Expired connections don’t count toward monthly usage—billing resumes only if the user re-authenticates.