Overview
The OnlyFans SDK supports three distinct modes of operation, each with its own configuration options. Choose the mode that best fits your use case and infrastructure requirements.Configuration Options
Complete Configuration Reference
The SDK operation mode. Choose
"access" for managed API calls, "direct" for full control, or "custom" for enterprise setups.Your OFAuth API key. Required for
"access" mode and when signRequests: true in custom mode.Enable detailed request/response logging for debugging purposes.
Custom API base URL for custom mode. Requests will be prefixed with this URL.
Whether to sign requests using OFAuth’s dynamic rules in custom mode.
Function to modify requests before they’re sent. Useful for adding custom headers or authentication.
Configuration Modes
Access Mode (Recommended)
Best for: Most applications, managed API calls through OFAuthAccess mode uses OFAuth’s managed infrastructure to handle OnlyFans API complexities automatically.
- Automatic request signing and session management
- Built-in error handling and retry logic
- No need to manage OnlyFans API changes
- Simplified authentication flow
- Usage tracking and analytics
- Valid OFAuth API key
- Active OFAuth subscription
Direct Mode
Best for: Full control over API requests, custom session management, local debugging- Direct communication with OnlyFans API
- Full control over request/response handling
- No usage costs for OFAuth services
- Custom session management
- Detailed debugging capabilities
- Valid OFAuth API key (for request signing rules)
- Manual session management
- Handling of OnlyFans API updates
- Development and testing environments
- Custom authentication flows
- Applications with specific session requirements
- Cost-sensitive implementations
Custom Mode
Best for: Enterprise setups with custom proxy infrastructure- Custom API endpoint configuration
- Request modification capabilities
- Optional OFAuth request signing
- Enterprise proxy support
- Custom authentication integration
- Custom API infrastructure
- OFAuth API key (if using request signing)
- Enterprise environments with proxy requirements
- Custom API gateways
- Multi-tenant applications
- Advanced security requirements
Environment Variables
For security and deployment flexibility, use environment variables for sensitive configuration:.env
Debug Configuration
Enable detailed logging to troubleshoot issues during development:Advanced Custom Configuration
For complex enterprise setups, thebeforeRequest function provides powerful request modification capabilities: