Overview
Hosted Mode provides the simplest integration path for OnlyFans authentication. Users are redirected to OFAuth’s secure authentication pages, reducing your security burden while providing a seamless authentication experience.Prefer a popup experience? Use our Link Embed Library to keep users
in your app rather than redirecting them away from your site.
How It Works
- Initialize: Create a link session with your redirect URL
- Redirect/Popup: Send users to OFAuth’s secure authentication page
- Authentication: Users complete authentication on OFAuth’s pages
- Return: Users are redirected back to your URL with status and connection details
- Process: Handle the query params to complete the flow
Integration Options
Hosted Mode offers two integration approaches to fit your application’s user experience:Redirect Integration
Traditional Flow - Redirect users to OFAuth’s authentication pages.
Perfect for web applications and simple mobile integrations.
Popup/Embed Integration
Seamless UX - Use our Embed SDK to display authentication in a popup or
iframe. Keeps users in your application throughout the flow.
Base URL
Authentication
All requests require your API key header:Core Endpoints
Initialize Hosted Session
Create a new hosted authentication session.Redirect Query Parameters
After authentication completes, OFAuth redirects users to your URL with query parameters.All Parameters
| Parameter | Type | Present | Description |
|---|---|---|---|
status | string | Always | success, cancelled, or error |
connection_id | string | On success | The connection ID to use with Access API |
client_reference_id | string | If provided | Your internal user identifier from /init |
step | string | On cancel | Where the user exited the flow |
error_code | string | On error | Machine-readable error identifier |
Status Values
| Value | Meaning |
|---|---|
success | Authentication completed, connection_id is available |
cancelled | User exited the flow, check step for where |
error | Something went wrong, check error_code |
Step Values (when status=cancelled)
| Value | Description |
|---|---|
pre-login | Before entering credentials |
login | During credential entry |
2fa | During two-factor authentication |
authorization | Reviewing permissions |
Error Codes (when status=error)
| Code | Description |
|---|---|
session_expired | Link session expired (1 hour limit) |
invalid_credentials | User entered wrong credentials |
account_locked | OnlyFans account is locked |
2fa_failed | Two-factor authentication failed |
Retrieve Session Status
Check the current status of a hosted session.Delete Session
Clean up a hosted session.Security: Allowed Redirect URIs
YourredirectUrl must be pre-registered in your OFAuth dashboard as an Allowed Redirect URI.
Exact Match
We require exact URL matches (scheme, host, path). Query parameters are added by OFAuth on redirect.
HTTPS Required
Always use HTTPS in production. Configure multiple URLs for different environments.
Misconfiguration Behavior
- If you pass a
redirectUrlnot on your allowlist,/v2/link/initreturns400withLink is misconfigured. - If no Allowed Redirect URIs are configured, you must add at least one before using Link.
Implementation Guide
Step 1: Initialize the Session
Step 2: Redirect User to Authentication
After initialization, redirect the user to the authentication URL:Step 3: Handle the Callback
When users complete or cancel authentication, they’ll be redirected to your URL with query params:Integration Examples
React Component
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 for security
State Management
Store connection IDs securely in your database
Error Handling
Session Expired
Session Expired
/initInvalid Redirect URL
Invalid Redirect URL
Authentication Failed
Authentication Failed
User is redirected with
?status=error&error_code=invalid_credentialsSolution: User needs to retry authentication with correct credentialsTesting
Sandbox Mode: Use sandbox API keys for development. Test sessions work with demo
credentials that are provided on the hosted authentication page.
Next Steps
Looking for a fully custom experience? Enterprise Whitelabel mode is available for approved partners who need direct control over authentication flows.