codeQuick Start

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

circle-info

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_)

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";
    
    // 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

triangle-exclamation

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:

circle-check

What Happens Behind the Scenes?

1

For security reasons, we are not sharing this on a public website. If you would like to receive information, please send us an email.

Next Steps

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

See GetKeyInfo for details.

Common Issues

chevron-rightConnection Failedhashtag

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

chevron-rightInvalid Licensehashtag

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

chevron-rightHWID Mismatchhashtag

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

circle-exclamation
chevron-rightUse Environment Variableshashtag
chevron-rightUse String Obfuscationhashtag

The _xor_ macro obfuscates strings at compile time.

chevron-rightSeparate Configuration Filehashtag

Create config.h:

Add to .gitignore:

Resources

  • Installation - Setup guide

  • Configuration - Detailed configuration

  • API Reference - Function documentation

  • Dashboard Guide - Web dashboard usage

Last updated