DryreL Software Documentation

Patreon Authenticator for Unity

Complete guide for integrating Patreon Authenticator for Unity into your Unity projects

Welcome to Patreon Authenticator for Unity

A comprehensive Unity package for integrating Patreon OAuth 2.0 authentication with embedded HTTP server support, advanced security features, and cross-platform compatibility.

Getting Started

Patreon Authenticator for Unity is a powerful plugin that enables seamless integration between your Unity games and Patreon’s authentication system. This plugin allows you to:

  • Advanced Security: AES-256 encryption, obfuscation, and secure storage
  • Embedded HTTP Server: Built-in HTTP listener for OAuth callbacks
  • Middleware Support: Custom middleware for OAuth callbacks across all platforms
  • Cross-Platform Support: Works on WebGL, Android, iOS, Windows, Mac, and Linux
  • Secure Token Management: Device-specific encryption with PBKDF2 key derivation
  • Thread-Safe Operations: Proper handling of HTTP requests
  • Beautiful Callback UI: Customizable HTML success/error pages
  • State Validation: CSRF protection with state parameter validation
  • Token Refresh: Automatic access token refresh
  • User Profile Fetching: Retrieve user information and subscription details
  • Security Testing: Built-in security validation and testing tools
  • GIF Support: Animated Patreon avatars with GIF animation support

Prerequisites

Before you begin, make sure you have:

  • Unity 2021.3 LTS or later
  • .NET Standard 2.1 or later
  • A Patreon creator account
  • Basic knowledge of Unity and C#
  • Internet connection for Patreon API calls

Important Note

This plugin requires Unity 2021.3 LTS or later. Older versions are not supported.

Installation

1. Install Newtonsoft.Json Package (Required)

IMPORTANT: This step is mandatory before using the plugin!

  1. Open Unity’s Package Manager (Window → Package Manager)
  2. Click on the “+” button
  3. Select “Install package by name…”
  4. Enter com.unity.nuget.newtonsoft-json
  5. Click “Add” to install the package

Without this package, the scripts will not compile!

2. Copy Plugin Files

  1. Copy the Assets/Plugins/PatreonAuthenticatorForUnity/ folder to your Unity project
  2. Copy the Assets/StreamingAssets/patreon-callback.html file to your StreamingAssets folder

3. Scene Setup

  1. Create PatreonConfig Asset:
    • Navigate to Resources folder (create if there is no folder)
    • Right-click in Project window
    • Navigate to Create → Patreon Authenticator for Unity → Create New Config
    • This will create the asset in Assets/Resources/ folder (PatreonConfig)
    • Configure basic settings (see Configuration section below)
    • Client ID and Client Secret will be set later using PatreonReEncryptCredentials script
  2. Create PatreonManager GameObject:
    • Right-click in Hierarchy window
    • Select Create Empty
    • Rename the GameObject to PatreonManager
  3. Add Required Scripts to PatreonManager:
    • Select the PatreonManager GameObject
    • Add Component → PatreonManager script
    • IMPORTANT: Assign the PatreonConfig asset to the “Patreon Config” field
    • Add Component → PatreonCallbackManager script (handles all platforms, requires the following components)
    • Add Component → PatreonEmbeddedServer script (desktop platforms only)
    • Add Component → PatreonDeepLinkHandler script (mobile platforms only)
    • Add Component → PatreonWebGLHandler script (WebGL platform only)

    All scripts compatible and can be used together.

  4. Platform-Specific Setup:

    📱 Mobile Platforms (Android/iOS):

    • The PatreonDeepLinkHandler will be used automatically
    • Android Setup: Add to your AndroidManifest.xml:
      <activity android:name="com.unity3d.player.UnityPlayerActivity">
        <intent-filter>
          <action android:name="android.intent.action.VIEW" />
          <category android:name="android.intent.category.DEFAULT" />
          <category android:name="android.intent.category.BROWSABLE" />
          <data android:scheme="PatreonAuthenticatorForUnity.oauth" />
        </intent-filter>
      </activity>
      
    • iOS Setup: Add to your Info.plist:
      <key>CFBundleURLTypes</key>
      <array>
        <dict>
          <key>CFBundleURLName</key>
          <string>Patreon OAuth</string>
          <key>CFBundleURLSchemes</key>
          <array>
            <string>PatreonAuthenticatorForUnity.oauth</string>
          </array>
        </dict>
      </array>
      

    🌐 WebGL Platform:

    • The PatreonWebGLHandler will be used automatically
    • Uses middleware for OAuth callbacks (no additional setup needed)

    🖥️ Desktop Platforms (Windows/Mac/Linux):

    • The PatreonEmbeddedServer will be used automatically
    • Creates a local HTTP server on localhost:3000
  5. Middleware Information:
    • All platforms use middleware for OAuth callbacks
    • The middleware handles the OAuth flow and redirects to your app
    • Custom URI Scheme: Configured in PatreonConfig (default: PatreonAuthenticatorForUnity.oauth)
    • Free Middleware Option: You can create your own middleware using GitHub Pages
    • Copy the middleware code from Assets/StreamingAssets/patreon-callback.html
    • Deploy it to GitHub Pages for a free middleware solution
    • Update the redirect URI in your PatreonConfig to point to your middleware
    • Custom URI Scheme: Update the middleware to use your custom URI scheme from PatreonConfig
  6. Verify Setup:
    • The PatreonManager GameObject should have all required scripts attached
    • PatreonConfig should be assigned in the PatreonManager component
    • No compilation errors should appear in the Console

Installation Complete

After importing from Unity Asset Store, you should see the 'PatreonAuthenticatorForUnity' folder in your Assets/Plugins directory.

Security Features

Advanced Encryption System

The plugin includes a comprehensive security system to protect your Patreon credentials:

AES-256 Encryption

  • Client Secret is encrypted using AES-256 with device-specific keys
  • PBKDF2 Key Derivation with 10,000 iterations for maximum security
  • Device-specific encryption - keys are unique per device/application
  • Automatic IV generation for each encryption operation

XOR Obfuscation

  • Client ID is obfuscated using XOR encryption
  • Base64 encoding for safe storage
  • Lightweight protection suitable for public identifiers

Secure Storage

  • Encrypted PlayerPrefs storage for sensitive data
  • Automatic cleanup of sensitive data from memory
  • Secure deletion methods for removing stored data

Security Validation

  • Built-in security testing with PatreonSecurityTest component
  • Automatic validation of encryption/decryption operations
  • Performance testing for security operations
  • Memory security validation

Security Levels

Level Client ID Client Secret Use Case
Maximum Obfuscated Encrypted Production
High Plain Text Encrypted Development
Medium Obfuscated Plain Text Testing
None Plain Text Plain Text NOT RECOMMENDED

Security Best Practices

  1. Always enable encryption for Client Secret in production
  2. Use obfuscation for Client ID when possible
  3. Never commit PatreonConfig.asset to version control
  4. Test security system before building for production
  5. Use secure storage for any sensitive data
  6. Clear sensitive data from memory when no longer needed

CRITICAL: Secure Credentials Setup

THIS IS EXTREMELY IMPORTANT FOR SECURITY!

Your Patreon credentials (Client ID and Client Secret) are extremely sensitive and must be encrypted before use. NEVER store them in plain text!

Why This Matters

  • Plain Text = Security Risk: If your credentials are stored in plain text, anyone with access to your build can steal them
  • Financial Impact: Stolen credentials can be used to access your Patreon account and potentially cause financial damage
  • Professional Impact: Security breaches can damage your reputation and trust with users
  • Legal Implications: Inadequate security measures can lead to legal issues

How to Securely Set Up Your Credentials

Follow these steps to encrypt your Patreon credentials:

Step 1: Create Re-Encryption GameObject

  1. Create a new empty GameObject in your scene
  2. Rename it to something like "PatreonEncryptCredentials" (you’ll delete this later)
  3. Add the PatreonEncryptCredentials script to the GameObject

Step 2: Enter Your Real Credentials

  1. Select the GameObject in the Hierarchy
  2. In the Inspector, you’ll see the re-encryption script with clear instructions
  3. Fill in your real credentials in the designated fields:
    • Real Client Id: Your Patreon Client ID
    • Real Client Secret: Your Patreon Client Secret
  1. Drag your PatreonConfig asset to the PatreonConfig Asset field
  2. If you assign PatreonConfig: Values will be set automatically after encryption
  3. If you don’t assign PatreonConfig: You’ll need to manually copy the encrypted values

Step 4: Re-Encrypt Your Credentials

  1. Right-click on the script in the Inspector
  2. Select “Re-Encrypt All Credentials” from the context menu
  3. Wait for the process to complete - you’ll see success messages in the Console

Step 5: Verify and Clean Up

  1. Check the Console for success messages
  2. If PatreonConfig was assigned: Values are automatically set
  3. If PatreonConfig was NOT assigned: Copy the encrypted values to your PatreonConfig manually
  4. Delete the GameObject - you don’t need it in your scene anymore

Configuration

Patreon Setup

Before configuring the plugin in Unity, you need to set up your Patreon application:

  1. Become a Patreon Creator:
  2. Create OAuth Client:
    • Click “Create Client” or “Register New Client”
    • Fill in your application details
    • IMPORTANT: Set redirect URI to: http://localhost:3000/patreon-callback
    • This must match exactly with your PatreonConfig redirect URI
  3. Get Your Credentials:
    • Client ID: Copy from your OAuth client settings
    • Client Secret: Copy from your OAuth client settings (keep this secret!)
    • Creator ID: Your Patreon username (e.g., if your Patreon is patreon.com/DryreL, your Creator ID is DryreL)

SECURITY WARNING:

  • NEVER share your Client ID and Client Secret with anyone
  • NEVER commit these values to version control
  • NEVER post them in public forums or Discord channels
  • These credentials give full access to your Patreon account

Unity Settings

After creating the PatreonConfig asset (see Scene Setup above), configure your Patreon API settings:

  • Redirect URI: http://localhost:3000/patreon-callback (must match Patreon console settings)
  • Creator ID: Your Patreon username (e.g., DryreL for patreon.com/DryreL)
  • Authentication Timeout: How long to wait for user authentication (default: 120 seconds)

CRITICAL: The Redirect URI in PatreonConfig must exactly match the one in your Patreon Developer Console settings!

IMPORTANT: Never commit PatreonConfig to version control!

  • Add Assets/Resources/PatreonConfig.asset to your .gitignore
  • This file contains sensitive API credentials

Client ID and Client Secret will be set automatically when you use the PatreonEncryptCredentials script!

🌐 Middleware Setup Guide

Dynamic URI Scheme Usage

This plugin now uses a middleware system that allows all platforms to use a single redirect URI.

1. OAuth URL Creation:

https://yourdomain.com/api/oauth/redirect?scheme=YOUR_APP_SCHEME

Examples:

  • https://yourdomain.com/api/oauth/redirect?scheme=mygame.oauth
  • https://yourdomain.com/api/oauth/redirect?scheme=awesomeapp.auth
  • https://yourdomain.com/api/oauth/redirect?scheme=unitygame.patreon

2. Patreon App Settings:

  • Redirect URI: https://yourdomain.com/api/oauth/redirect?scheme=YOUR_APP_SCHEME
  • Client ID: Same as before
  • Client Secret: Same as before

3. Platform Setup:

Android (AndroidManifest.xml):
<activity android:name="com.unity3d.player.UnityPlayerActivity">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="YOUR_APP_SCHEME" />
    </intent-filter>
</activity>
iOS (Info.plist):
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>Patreon OAuth</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>YOUR_APP_SCHEME</string>
        </array>
    </dict>
</array>

4. PatreonConfig Setup:

Configure your custom URI scheme in PatreonConfig:

  • Custom URI Scheme: Set to your desired scheme (e.g., mygame.oauth)
  • Redirect URI: Update to match your middleware URL
  • All changes: Made through PatreonConfig interface

5. Test URL:

https://yourdomain.com/api/oauth/redirect?scheme=YOUR_APP_SCHEME&code=test123&state=test456

✅ Benefits:

  • Single middleware for all games
  • Dynamic scheme different for each game
  • Easy setup just change the scheme
  • Automatic platform detection

🔧 Usage:

  1. Choose scheme: mygame.oauth
  2. Patreon App Settings: https://yourdomain.com/api/oauth/redirect?scheme=mygame.oauth
  3. Copy platform files and change the scheme
  4. Set customUriScheme in Unity
  5. Test it! 🎯

👑 Creator API Setup (Optional)

For advanced features like campaign data, member lists, and tier information:

Step 1: Get Creator’s Access Token

  1. Go to Patreon Developer Console
  2. Create “Creator’s Access Token” (not OAuth Client)
  3. Select scopes: campaigns, campaigns.members, campaigns.tiers
  4. Copy your Access Token and Refresh Token

Step 2: Enable Creator API

  1. In PatreonEncryptCredentials script:
    • ✅ Check “Enable Creator API”
    • Enter your Creator Access Token
    • Enter your Creator Refresh Token
  2. Click “Encrypt All Credentials”
  3. Values will be automatically set to PatreonConfig

Alternative: Manual Configuration

You can also set Creator API tokens directly in PatreonConfig:

  • Creator Access Token: Set in PatreonConfig for campaign/member data access
  • Creator Refresh Token: Set in PatreonConfig for token renewal
  • Enable Creator API: Toggle in PatreonConfig to enable advanced features

Note: But make sure to encryption is done!

Step 3: Use Creator API

// Get campaign information
StartCoroutine(PatreonManager.Instance.GetCampaignInfo());

// Get all campaign members/patrons
StartCoroutine(PatreonManager.Instance.GetCampaignMembers());

// Get campaign tiers/rewards
StartCoroutine(PatreonManager.Instance.GetCampaignTiers());

Step 4: Display in UI

Use PatreonUserInfoDisplay with new fields:

  • Campaign Name, Campaign Summary, Patron Count
  • Tier Amount, Tier Description, Tier Limit
  • Member Since, Pledge Status, Next Charge

Reference: Patreon API Guide

Authentication

Login Flow

The authentication process follows OAuth 2.0 standards:

  1. Initialize the authenticator
  2. Start the login process
  3. Handle the callback
  4. Validate the token

Here’s a basic example:

using DryreL.Patreon;

public class PatreonManager : MonoBehaviour
{
    private PatreonAuthenticator authenticator;
    
    void Start()
    {
        authenticator = new PatreonAuthenticator();
        authenticator.OnLoginSuccess += OnLoginSuccess;
        authenticator.OnLoginFailed += OnLoginFailed;
    }
    
    public void Login()
    {
        authenticator.StartLogin();
    }
    
    private void OnLoginSuccess(PatreonUser user)
    {
        Debug.Log($"Welcome, {user.FullName}!");
        // Handle successful login
    }
    
    private void OnLoginFailed(string error)
    {
        Debug.LogError($"Login failed: {error}");
        // Handle login failure
    }
}

Token Management

The plugin automatically handles token refresh and storage:

// Check if user is authenticated
if (authenticator.IsAuthenticated)
{
    // Get current user
    PatreonUser user = authenticator.CurrentUser;
    
    // Check subscription status
    bool isSubscriber = user.IsSubscriber;
    string tier = user.SubscriptionTier;
}

API Reference

Classes

PatreonManager

The main singleton class for handling Patreon authentication.

Properties:

  • bool IsUserAuthenticated() - Returns true if user is logged in
  • PatreonUser GetCurrentUser() - Gets the current authenticated user
  • string GetValidAccessToken() - Gets a valid access token (refreshes if needed)

Methods:

  • void StartPatreonAuth() - Initiates the Patreon OAuth flow
  • void Logout() - Logs out the current user and clears tokens
  • void SetAccessToken(string token) - Sets the access token
  • void ExchangeCodeForToken(string code, string state) - Exchanges authorization code for access token

PatreonUser

Represents a Patreon user with their subscription information.

Properties:

  • string Id - User’s Patreon ID
  • string FullName - User’s full name
  • string Email - User’s email address
  • string FirstName - User’s first name
  • string LastName - User’s last name
  • string Vanity - User’s vanity URL
  • string ImageUrl - User’s profile image URL
  • bool IsPatron - Whether user is a patron
  • float PledgeAmount - Pledge amount in dollars
  • bool HasPledge - Whether user has an active pledge
  • string DisplayName - User’s display name
  • string PatronStatus - User’s patron status
  • string TierTitle - User’s subscription tier title
  • int CentsPledged - Pledge amount in cents

Methods:

  • void LoadProfileAvatar(Action<Sprite> onComplete) - Loads user’s profile avatar as Sprite

Methods

StartLogin()

Initiates the Patreon OAuth flow.

public void StartLogin()

Returns: void

Example:

authenticator.StartLogin();

Logout()

Logs out the current user and clears stored tokens.

public void Logout()

Returns: void

Example:

authenticator.Logout();

Events

OnLoginSuccess

Fired when a user successfully logs in.

public event Action<PatreonUser> OnLoginSuccess;

Parameters:

  • PatreonUser user - The authenticated user

OnLoginFailed

Fired when login fails.

public event Action<string> OnLoginFailed;

Parameters:

  • string error - Error message describing the failure

Examples

Basic Authentication

using UnityEngine;

public class SimplePatreonExample : MonoBehaviour
{
    void Start()
    {
        // Subscribe to events
        PatreonManager.OnUserAuthenticated += HandleLoginSuccess;
        PatreonManager.OnAuthenticationFailed += HandleLoginFailed;
    }
    
    public void LoginButtonClicked()
    {
        PatreonManager.Instance.StartPatreonAuth();
    }
    
    private void HandleLoginSuccess(PatreonUser user)
    {
        Debug.Log($"Welcome {user.FullName}!");
        
        if (user.IsPatron)
        {
            Debug.Log($"You are a patron with tier: {user.TierTitle}");
            Debug.Log($"Pledge amount: ${user.PledgeAmount:F2}");
            // Unlock premium content
        }
        else
        {
            Debug.Log("You are not a patron");
            // Show subscription prompt
        }
    }
    
    private void HandleLoginFailed(string error)
    {
        Debug.LogError($"Login failed: {error}");
        // Show error message to user
    }
}

Premium Content Management

public class PremiumContentManager : MonoBehaviour
{
    [SerializeField] private PatreonAuthenticator authenticator;
    [SerializeField] private GameObject premiumContent;
    
    void Start()
    {
        CheckSubscriptionStatus();
    }
    
    private void CheckSubscriptionStatus()
    {
        if (authenticator.IsAuthenticated)
        {
            PatreonUser user = authenticator.CurrentUser;
            
            if (user.IsSubscriber)
            {
                EnablePremiumContent(user.SubscriptionTier);
            }
            else
            {
                DisablePremiumContent();
            }
        }
        else
        {
            DisablePremiumContent();
        }
    }
    
    private void EnablePremiumContent(string tier)
    {
        premiumContent.SetActive(true);
        
        // Configure content based on tier
        switch (tier)
        {
            case "Bronze":
                // Bronze tier features
                break;
            case "Silver":
                // Silver tier features
                break;
            case "Gold":
                // Gold tier features
                break;
        }
    }
    
    private void DisablePremiumContent()
    {
        premiumContent.SetActive(false);
    }
}

Troubleshooting

Common Issues

“Invalid Client ID” Error

Problem: You’re getting an “Invalid Client ID” error when trying to authenticate.

Solution:

  1. Verify your Client ID in the Patreon Developer Portal
  2. Make sure the Client ID is correctly entered in Unity’s Project Settings
  3. Ensure your application is properly configured in Patreon

Token Refresh Issues

Problem: Tokens are not refreshing automatically.

Solution:

  1. Check your internet connection
  2. Verify your Client Secret is correct
  3. Ensure your redirect URI matches exactly

Unity Build Issues

Problem: The plugin works in the editor but not in builds.

Solution:

  1. Make sure all required dependencies are included in the build
  2. Check that your Patreon configuration is properly set for production
  3. Verify your redirect URI is accessible from your deployed application

Debug Mode

Enable debug mode to get more detailed logging:

PatreonConfig config = new PatreonConfig
{
    // ... other settings
    DebugMode = true
};

Platform Support

Platform Status Notes
WebGL ✅ Full Support Browser-based authentication with embedded server
Android ✅ Full Support Native integration with browser, middleware (custom URI)
iOS ✅ Full Support Native integration with browser, middleware (custom URI)
Windows ✅ Full Support 32-bit & 64-bit builds
Mac ✅ Full Support Universal binary support
Linux ✅ Full Support All major distributions

Mobile Platform Features

  • Application.identifier: Full support on iOS/Android
  • Device ID: Secure device-specific encryption keys
  • System Browser: Native OAuth flow with app resume
  • StreamingAssets: Platform-specific file handling
  • URL Schemes: Custom callback handling

🔗 Platform-Specific Callback Handling

All Platforms (Unified Middleware System)

  • Single Redirect URI: https://yourdomain.com/api/oauth/redirect?scheme=YOUR_APP_SCHEME
  • Dynamic Scheme: Each game can use its own URI scheme
  • Platform Detection: Automatic platform detection and routing
  • Universal Support: Works on Desktop, Mobile, and WebGL

Mobile Platforms (Android, iOS, Windows, UWP)

  • Deep Linking: Custom URI scheme (YOUR_APP_SCHEME://patreon-callback)
  • Middleware Redirect: https://yourdomain.com/api/oauth/redirect → Deep link
  • System Browser: Native OAuth flow with automatic app resume
  • State Validation: CSRF protection with state parameter

WebGL Platform

  • Middleware Flow: Uses https://yourdomain.com/api/oauth/redirect
  • JavaScript Callback: postMessage communication with parent window
  • No Server Required: Uses hosted middleware service
  • CORS Support: Cross-origin request handling

Desktop Platforms (Windows, Mac, Linux)

  • Middleware Redirect: https://yourdomain.com/api/oauth/redirect → localhost:3000
  • Embedded Server: HTTP Listener on localhost:3000
  • Loopback Flow: Browser → middleware → localhost → app callback
  • No Dependencies: Pure .NET HttpListener implementation

📱 Mobile Setup Requirements

Android Setup

  1. Create AndroidManifest.xml in Assets/Plugins/Android/: ```xml

#### **iOS Setup**
1. **Player Settings** → **Other** → **Configuration**
2. **Add to Supported URL schemes**: `YOUR_APP_SCHEME`
3. Make sure **ios-info.plist** created.
4. **Xcode**: Verify URL scheme registration

#### **Patreon OAuth Client Configuration**
- **All Platforms**: Use single redirect URI with middleware
- **Redirect URI**: `https://yourdomain.com/api/oauth/redirect?scheme=YOUR_APP_SCHEME`
- **Client Type**: Select "Web application" (works for all platforms)
- **Dynamic Scheme**: Each game uses its own URI scheme

### 🌐 **Unified Middleware System**

**Hosted Middleware**: `https://yourdomain.com/api/oauth/redirect`

**Features:**
- **Platform Detection**: Automatic platform detection and routing
- **Dynamic Scheme**: Each game uses its own URI scheme
- **Universal Support**: Works on Desktop, Mobile, and WebGL
- **No Setup Required**: Uses hosted middleware service

**Middleware Workflow:**
1. **Patreon** → `https://yourdomain.com/api/oauth/redirect?scheme=YOUR_APP_SCHEME&code=...&state=...`
2. **Middleware** → Platform detection
3. **Redirect** → Platform-specific callback method

### 🚀 **Usage Examples**

#### **Platform-Specific OAuth Flow**
```csharp
// Automatic platform detection and callback handling
PatreonCallbackManager callbackManager = GetComponent<PatreonCallbackManager>();
callbackManager.StartPatreonOAuthFlow(clientId, state);

// Get platform-specific redirect URI
string redirectUri = callbackManager.GetPlatformRedirectUri();
Debug.Log($"Platform redirect URI: {redirectUri}");
// Mobile deep link callback (called by system)
PatreonDeepLinkHandler deepLinkHandler = GetComponent<PatreonDeepLinkHandler>();
deepLinkHandler.HandleDeepLinkCallback("myapp.oauth://patreon-callback?code=abc123&state=xyz789");

// Test deep link callback
deepLinkHandler.TestDeepLinkCallback();

WebGL Middleware Handling

// WebGL middleware callback
PatreonWebGLHandler webGLHandler = GetComponent<PatreonWebGLHandler>();
webGLHandler.StartPatreonOAuthFlow(clientId, state);

// Test WebGL callback
webGLHandler.TestWebGLCallback();

Platform Information

// Show current platform and callback method
PatreonCallbackManager callbackManager = GetComponent<PatreonCallbackManager>();
callbackManager.ShowPlatformInfo();

// Output:
// 📱 Current Platform: AndroidPlayer
// 📱 Redirect URI: myapp.oauth://patreon-callback
// 🔗 Using deep link callback method

🧪 Testing

Test Commands

  • Test Platform OAuth Flow: Test platform-specific OAuth flow
  • Test Deep Link Callback: Test mobile deep link handling
  • Test WebGL Callback: Test WebGL middleware handling
  • Show Platform Info: Display current platform information

Test Scripts

  • PatreonCallbackManager: Platform-specific testing
  • PatreonDeepLinkHandler: Mobile deep link testing
  • PatreonWebGLHandler: WebGL middleware testing
  • PatreonMobileTest: Mobile compatibility testing

Security Testing

The plugin includes a comprehensive security testing system:

1. Add Security Test Component

// Add PatreonSecurityTest component to any GameObject
// Right-click on GameObject → Add Component → PatreonSecurityTest

2. Run Security Tests

// In Inspector, click "Run All Security Tests" or use code:
var securityTest = GetComponent<PatreonSecurityTest>();
securityTest.RunAllTests();

3. Test Individual Components

// Test encryption only
securityTest.TestEncryption();

// Test obfuscation only
securityTest.TestObfuscation();

// Test secure storage only
securityTest.TestSecureStorage();

// Performance test
securityTest.PerformanceTest();

4. Security Validation

// Validate entire security system
bool isValid = PatreonSecurity.PatreonSecurity.ValidateSecuritySystem();
Debug.Log($"Security system valid: {isValid}");

Support

Getting Help

If you encounter any issues or have questions:

  1. Check the documentation - Most common issues are covered here
  2. Join our Discord community - Get help from other developers and our team
  3. Contact support - For technical issues, contact us with:
    • Unity version
    • Plugin version
    • Steps to reproduce
    • Error messages
    • Log files

Community

Join our community for support and updates:

Updates

Stay updated with the latest features and bug fixes:

DISCLAIMER & LIABILITY

IMPORTANT SECURITY NOTICE

This plugin provides AES-256 encryption and obfuscation features to help protect your Patreon API credentials. However, YOU ARE FULLY RESPONSIBLE for the security of your credentials and any consequences that may arise from their exposure.

Security Features Provided

  • AES-256 Encryption: For Client Secret protection
  • XOR Obfuscation: For Client ID obfuscation
  • Multi-layer Key Derivation: Platform-specific encryption keys
  • Anti-tampering Protection: Basic integrity validation
  • Security Audit Logging: Monitoring and debugging tools

Your Responsibilities

  • Secure Storage: Never commit PatreonConfig to version control
  • Proper Usage: Follow all security guidelines in this documentation
  • Regular Updates: Keep credentials updated and rotated
  • Environment Security: Ensure your development and production environments are secure
  • Access Control: Limit access to credential files and build artifacts

Liability Disclaimer

DRYREL HUB SHALL NOT BE LIABLE for any direct, indirect, incidental, special, consequential, or punitive damages, including but not limited to:

  • Financial Losses: Revenue loss, business interruption, or monetary damages
  • Security Breaches: Unauthorized access to your Patreon account or data
  • API Abuse: Misuse of your credentials by third parties
  • Data Exposure: Leakage of sensitive information
  • Service Disruption: Downtime or service unavailability
  • Legal Consequences: Any legal issues arising from credential exposure

USE THIS PLUGIN AT YOUR OWN RISK. NO WARRANTIES ARE PROVIDED.

🔧 API V2 Account Type Issues & Solutions

⚠️ Known Issues with Different Account Types

When testing with different Patreon account types (Creator vs Regular User), you may encounter the following issues:

1. Email Not Retrieved

  • Issue: Email field returns empty for regular users
  • Cause: OAuth scope limitations
  • Solution: Enhanced OAuth scopes now include identity[email]

2. Profile Image Not Retrieved

  • Issue: Profile image URL is empty
  • Cause: API field mapping differences
  • Solution: Automatic fallback to thumb_url if image_url is empty

3. Incorrect Tier/Status Information

  • Issue: Regular users showing as “creator” tier
  • Cause: API response inconsistencies between account types
  • Solution: Enhanced logging and validation (see console warnings)
  • Issue: YouTube, Twitter, Facebook links are empty
  • Cause: Limited API field access for regular users
  • Solution: Enhanced field requests in API calls

🔍 Debug Information

The plugin now includes comprehensive debug logging. Check the Unity Console for:

  • 🔧 === USER DATA DEBUG === - Complete user data analysis
  • 🔧 Email not available - Scope limitation warnings
  • 🔧 Normal user has tier_title - Account type inconsistencies

📋 Testing Checklist

When testing with different account types:

  1. Creator Account Test:
    • ✅ Email should be retrieved
    • ✅ Profile image should be retrieved
    • ✅ Tier information should be accurate
    • ✅ Social links may be available
  2. Regular User Account Test:
    • ⚠️ Email may not be available (scope dependent)
    • ✅ Profile image should be retrieved (with fallback)
    • ⚠️ Tier information may be incorrect (logged as warning)
    • ⚠️ Social links may not be available

🛠️ Enhanced OAuth Scopes

The plugin now requests enhanced scopes:

identity identity[email] identity.memberships campaigns

This provides better access to user data across different account types.

🔧 API Data Validation & Fixes

Important Note: The plugin includes client-side data validation and fixes for known Patreon API V2 inconsistencies. This is necessary because:

  1. API Data Issues: Patreon API V2 sometimes returns incorrect data for normal users (e.g., showing “Creator” tier for regular users)
  2. Data Contradictions: API may return conflicting values (e.g., patron_status: "not_patron" but is_patron: true)
  3. Account Type Mixing: User and creator data can sometimes be mixed in API responses
  4. Follower Status Issues: is_follower field is unreliable and may return false even when user is following

What the plugin does:

  • ✅ Validates all user data from API
  • ✅ Fixes known data inconsistencies automatically
  • ✅ Logs API issues for debugging
  • ✅ Provides fallback values when needed
  • ✅ Warns about unreliable fields like is_follower

Console Logs to Watch:

  • 🔧 API ISSUE: Normal user has incorrect tier_title: Creator - fixing
  • 🔧 API ISSUE: is_follower is false - this might be incorrect due to Patreon API V2 limitations
  • 🔧 API DATA ISSUES DETECTED AND FIXED - This indicates Patreon API V2 data inconsistencies

Known API Limitations:

  • is_follower: This field is unreliable in Patreon API V2 and may return false even when the user is following the creator
  • Follower Detection: To accurately detect followers, additional API calls to campaigns/pledges endpoints are required
  • Reference: See Patreon API Guide for proper follower detection methods

This approach ensures reliable user data regardless of API inconsistencies.


Thank You!

Thank you for using Patreon Authenticator for Unity. We hope this plugin helps you create amazing experiences for your Patreon supporters!