Quick Start

Get your application up and running with qPapel Auth in just a few minutes.

This guide assumes you have already completed the Installation steps.

Step 1: Get Your API Keys

1

Log in to your web dashboard

2

Navigate to Dashboard → API Integrations → API Keys

3

You will see three keys:

  • API Key (starts with pk_)

  • Product Secret Key (Base64 string)

  • Product HMAC Key (Base64 string)

4

Copy all three keys

Step 2: Create Your First Application

Create a new file main.cpp:

main.cpp
#include <iostream>
#include <string>
#include "qPapel.h"

int main() {
    std::cout << "--- qPapel Auth Demo ---\n" << std::endl;
    
    // Step 1: Configure
    qPapel::AuthConfig config;
    config.apiKey = "pk_your_api_key";
    config.productSecretKey = "your_secret_key";
    config.productHmacKey = "your_hmac_key";
    
    // Step 2: Initialize
    qPapel::ProtectedAuth auth;
    auth.Init(config);
    
    std::cout << "[1/3] Initializing..." << std::endl;
    
    // Step 3: Connect to server
    std::cout << "[2/3] Connecting to server..." << std::endl;
    
    if (!auth.SendHeartbeat()) {
        std::cerr << "Connection failed: " << auth.GetLastError() << std::endl;
        return 1;
    }
    
    std::cout << "Connected successfully!\n" << std::endl;
    
    // Step 4: Validate license
    std::cout << "[3/3] Enter license key: ";
    std::string licenseKey;
    std::cin >> licenseKey;
    
    std::cout << "Validating..." << std::endl;
    
    if (auth.ValidateKey(licenseKey)) {
        std::cout << "\nAuthenticated successfully!" << std::endl;
        std::cout << "Session Token: " << auth.GetSessionToken() << std::endl;
        
        // Your protected application code here
        std::cout << "\nWelcome to your protected application!" << std::endl;
        
    } else {
        std::cerr << "\nAuthentication failed: " << auth.GetLastError() << std::endl;
        return 1;
    }
    
    return 0;
}

Step 3: Replace API Keys

Step 4: Build and Run

Press F7 or click Build → Build Solution

Expected output:

Step 5: Create a Test License

1

Go to Dashboard → Keys

2

Click "Generate New Key"

3

Configure:

  • Duration: 30 days

  • Max Devices: 1

  • Note: "Test License"

4

Click "Create"

5

Copy the generated license key

Step 6: Test Your Application

Run your application and enter the test license key:

What Happens Behind the Scenes?

1

Initialization (Init)

  • Stores your API keys

  • Sets up encryption keys

  • Prepares authentication system

2

Connection (SendHeartbeat)

  • Connects to authentication server

  • Performs encrypted handshake

  • Sends HWID information

  • Receives security settings

  • Performs integrity check (if enabled)

  • Checks blacklists (if enabled)

  • Starts background monitoring

3

Validation (ValidateKey)

  • Sends encrypted license key to server

  • Server checks:

    • Key exists in database

    • Key is active (not suspended/expired)

    • HWID matches (if bound)

    • Device limit not exceeded

  • Returns session token if valid

Next Steps

Now that you have a working application, explore more features:

See GetKeyInfo for details.

Common Issues

Connection Failed

Error: "Connection failed: Socket creation failed"

Solutions:

  • Check internet connection

  • Verify firewall settings

  • Ensure server is running

  • Check SERVER_IP and SERVER_PORT in library

Invalid License

Error: "Authentication failed: Invalid key"

Solutions:

  • Verify license key is typed correctly

  • Check key exists in dashboard

  • Ensure key is active (not suspended/expired)

  • Verify key is for correct application

HWID Mismatch

Error: "Authentication failed: HWID mismatch"

Solutions:

  • License is bound to different device

  • Reset HWID from dashboard

  • Use correct device

  • Check HWID method in dashboard settings

Complete Example Application

For a full-featured example with menu system and all features, see:

  • Complete Example - Full application with menu

  • Basic Authentication - Simple auth example

Security Best Practices

Use Environment Variables
Use String Obfuscation

The _xor_ macro obfuscates strings at compile time.

Separate Configuration File

Create config.h:

Add to .gitignore:

Resources

  • Installation - Setup guide

  • Configuration - Detailed configuration

  • API Reference - Function documentation

  • Dashboard Guide - Web dashboard usage

Last updated