Skip to navigation

C++ guide

This page walks through the whole C++ SDK in the order you would use it in an app. Each step starts with the shortest code that works, then shows the other ways to do the same thing and when you would pick them. If you only want to get signed in quickly, read the first four sections and come back to the rest later.

Download the C++ SDK if you have not done so yet.

Requirements

SupportedRecommended
C++ standardC++11 and newer. Every C++ Language Standard setting in Visual Studio works, including the default.Leave your project’s setting as it is
Visual Studio2015 (v140 toolset), 2017 (v141), 2019 (v142), 2022 (v143) and newerThe newest one you have
Windows SDK8.1 and 1010
Other compilersclang-cl and MinGW-w64 (add -std=c++11 or newer)
WindowsWindows 7 SP1 or newer, 64-bit and 32-bit, Debug and Release
Extra librariesNone on Windows

You do not have to change any project setting. The header links the Windows libraries it needs (WinHTTP, CNG, DPAPI, user32, shell32, advapi32 and crypt32) by itself under Visual Studio and clang-cl. With MinGW, add -lwinhttp -lbcrypt -lcrypt32 -ladvapi32 -luser32 -lshell32 to your link command.

Add the SDK to your project

Copy AuthlyX.h next to your source files and include it:

#include "AuthlyX.h"

That is all for most projects. If you include AuthlyX.h from many .cpp files and want faster builds, compile the SDK code once instead of in every file:

  1. Add AUTHLYX_SEPARATE_IMPLEMENTATION to Project > Properties > C/C++ > Preprocessor > Preprocessor Definitions for all configurations.
  2. In exactly one .cpp file, define AUTHLYX_IMPLEMENTATION before the include:
#define AUTHLYX_IMPLEMENTATION
#include "AuthlyX.h"

Every other file keeps a plain #include "AuthlyX.h".

If your project already has nlohmann/json on its include path, the SDK finds it and uses your copy instead of the one inside the header. To always use the copy inside the header, define AUTHLYX_EMBEDDED_JSON.

Create the client

#include "AuthlyX.h"
AuthlyX app("YOUR_APP_KEY", "1.0.0");

The first value is your app’s AppKey. Find it in the dashboard under your application’s credentials. The second value is the version of the program you are building. AuthlyX compares it with the versions you allow in the dashboard, so raise it each time you ship a new build. See Allowed Versions.

Some things to know about the client:

  • Create one client for the whole program and keep it alive until the program exits. A global variable, like above, is the simplest way. A member of your main window or app class works too.
  • The client cannot be copied. Pass it around by reference (AuthlyX&) or keep a pointer to it.
  • AuthlyX, authlyx::AuthlyX and authlyx::client are the same class. Use whichever name you like.
  • Creating the client does not connect yet. It only prepares the SDK. Nothing is sent until you call init().

If you want to change how the SDK behaves, start from the default options instead:

authlyx::options MakeOptions()
{
auto options = authlyx::defaultOptions("YOUR_APP_KEY", "1.0.0");
options.update_prompt = false;
options.request_budget = std::chrono::milliseconds(15000);
return options;
}
AuthlyX app(MakeOptions());

All the options are listed in Options near the end of this page.

Every call returns a future

This is the one thing that trips most people up, so it gets its own section.

Calls that talk to AuthlyX, such as init, login or getVariable, return a std::future<authlyx::result>, not the result itself. A future is a value that will be ready later. Calling .get() on it waits until the reply has arrived and then hands you the result:

auto future = app.login("YOUR_LICENSE_KEY");
authlyx::result result = future.get();

You will normally write both on one line:

auto result = app.login("YOUR_LICENSE_KEY").get();

If you forget .get(), result is still the future, and the compiler stops at the next line with an error such as E0135 class "std::future<authlyx::result>" has no member "ok". Add .get() and it goes away.

There are three ways to deal with a future, and you can mix them in one program:

StyleLooks likeWaits?Use it when
Just call itapp.init();YesYou do not need to look at the result
.get()auto r = app.init().get();YesConsole apps, worker threads, startup code before a window opens
Callbackapp.init([](authlyx::result r) { ... });NoGUI apps where the window must keep drawing

“Waits” means the line does not finish until AuthlyX replies, usually well under a second. That is fine in a console app or on a worker thread. On the thread that draws your window (the UI thread or render loop) it freezes the window for that time, so use a callback or a worker thread there. Threads and GUI apps shows how.

Start the SDK

Call init() once, before signing in. It checks your AppKey and version, sets up this installation and reads update information. initialize() is the same call with a longer name.

Simplest

app.init();

This waits until AuthlyX replies and ignores the result. If your app needs an update, the SDK still shows the update message box. If there is no internet, your app carries on and the sign-in that follows will report the problem. This is the shortest way to start and is fine for a lot of apps.

Check the result

auto started = app.init().get();
if (!started.ok())
{
std::cout << started.message << '\n';
return 1;
}

init() gives you a result even when something is wrong, instead of throwing, so you do not need try here. These are the codes you can get:

Codeok()What happened
APP_INITIALIZEDtrueConnected. Continue to sign-in.
OFFLINE_MODEtrueNo internet, but this PC has saved offline access. Continue to sign-in. See Offline access.
NETWORK_...falseNo internet and nothing saved. Ask the user to check their connection and try again.
UPDATE_REQUIREDfalseThis version is older than the one set in your dashboard. The SDK has already shown an update box.
VERSION_MISMATCHfalseThis version is newer than the dashboard version and is not allowed.
APP_DISABLEDfalseYou paused the app in the dashboard.

With a callback

app.init([](authlyx::result started)
{
if (started.ok())
std::cout << "Connected\n";
else
std::cout << started.message << '\n';
});

This returns straight away. The SDK runs the lambda on a background thread once the reply arrives. The parameter is the result; you can name it anything. With C++14 or newer you can write [](auto started) instead of naming the type. Plain C++11 compilers need authlyx::result.

A callback never throws. If something goes wrong, the result it receives has ok() set to false with a code and message.

Sign in

There are three ways to sign in. Use the ones you enabled in the dashboard. See Choose a sign-in method.

app.login("YOUR_LICENSE_KEY"); // license key
app.login("YOUR_USERNAME", "YOUR_PASSWORD"); // username and password
app.deviceLogin(); // this Windows user, no form

app.licenseLogin("YOUR_LICENSE_KEY") does the same as app.login with one value. Device login only works for devices you approved first; see Device login.

Simplest

app.login(license);
if (app.hasAccess())
std::cout << "Welcome\n";
else
std::cout << "That key did not work\n";

app.login(license); waits for the reply. hasAccess() then tells you whether the user is signed in. You do not get the reason when it fails, which is the price for the short code.

Show why it failed

When AuthlyX refuses a sign-in, .get() throws authlyx::error. Catch it and show its message:

try
{
auto signedIn = app.login(license).get();
std::cout << signedIn.message << '\n';
}
catch (const authlyx::error& e)
{
std::cout << e.what() << '\n';
}

If .get() returns, the sign-in worked. e.what() is a message you can show to the user as it is. e.code is a fixed code for your own checks, such as INVALID_CREDENTIALS, LICENSE_NOT_FOUND, LICENSE_EXPIRED, LICENSE_BANNED, DEVICE_NOT_ALLOWED or DEVICE_LIMIT_REACHED. e.kind says what sort of problem it was:

e.kindMeaningWhat to do
serverAuthlyX answered and said no (wrong key, banned, expired and so on)Show the message
networkNo answer: no internet, firewall, timeoutAsk the user to retry. Do not treat it as a ban.
securityA reply failed verificationShow the message and do not unlock anything
storageThe SDK could not read or save its protected filesUsually a permissions problem on the PC
cancelledYou cancelled the request, or the client was closedNothing

All codes are on the Errors page.

With a callback

app.login(license, [](authlyx::result signedIn)
{
if (signedIn.ok())
std::cout << "Welcome\n";
else
std::cout << signedIn.message << '\n';
});
app.login(username, password, [](authlyx::result signedIn)
{
std::cout << signedIn.message << '\n';
});

No try is needed. A refused sign-in arrives as a result with ok() false and the same code and message the error would have had.

A sign-in function you can reuse

Most apps wrap sign-in in a function that returns true or false and fills in an error message:

bool SignIn(const std::string& license, std::string& error)
{
try
{
app.login(license).get();
return true;
}
catch (const authlyx::error& e)
{
error = e.what();
return false;
}
}
std::string error;
if (!SignIn(license, error))
std::cout << "Sign-in failed: " << error << '\n';

Create an account

registerUser creates a user account with a username, password and a license key, and signs it in:

try
{
app.registerUser("YOUR_USERNAME", "YOUR_PASSWORD", "YOUR_LICENSE_KEY").get();
std::cout << "Account created\n";
}
catch (const authlyx::error& e)
{
std::cout << e.what() << '\n';
}

Change the password or add time

Both need a signed-in user:

app.changePassword("CURRENT_PASSWORD", "NEW_PASSWORD").get();
app.redeemLicense("ANOTHER_LICENSE_KEY").get();

redeemLicense adds the time and plan of another key to the signed-in account. Both throw authlyx::error when they fail, like login.

Read the account

After sign-in, app.userData() returns the account details. Store it in a variable once, then read the fields from that variable:

auto u = app.userData();
std::cout << "User: " << u.Username << '\n';
std::cout << "Plan: " << u.Plan << '\n';
std::cout << "Expires: " << u.ExpiryDate << '\n';

The names match the C# SDK:

FieldTypeExampleNotes
Usernamestd::stringmayaOnly set for username and password accounts
LicenseKeystd::stringMAYA-4R8P-2N6K-9Q3WThe key used to sign in or linked to the account
Emailstd::stringmaya@example.comEmpty if none was given
Plan, Subscriptionstd::stringPlusSame value under two names
ExpiryDatestd::string2027/04/30Lifetime for lifetime access
IsLifetimeboolfalseTrue when access never ends
DaysLeftint12Days until access ends, rounded up. 0 for lifetime or expired.
RegisteredAt, LastLoginstd::string2026/08/12Dates as text
SID, Hwidstd::stringS-1-5-21-...The Windows user ID this sign-in is bound to
DeviceLimitint3Devices allowed for this account
IpAddress, Countrystd::stringNGWhere the sign-in came from
LoginTypestd::stringlicenseuser, license or device
Idstd::stringThe account’s ID
Featuresstd::vector<std::string>aim, espEnabled on/off features
FeatureValues, Metadataauthlyx::jsonSee the next section for easy ways to read them
rawauthlyx::jsonThe original data from AuthlyX

DaysLeft is counted from AuthlyX’s clock, not the PC’s, so changing the Windows date does not change it. One hour left shows as 1.

Why auto u = app.userData();

userData() is a function that returns a copy of the account at the moment you call it. Taking that copy into a variable means:

  • You write u.Plan instead of app.userData().Plan every time.
  • All the fields you read come from the same moment.
  • The copy is yours. The SDK can update its own data in the background (it does on every heartbeat) without changing values halfway through your function, so it is safe on any thread.

A local variable only exists inside the function where you declare it, so each function that reads account details starts with its own auto u = app.userData();. It is cheap, even if you call it every frame.

You can still skip the variable when you only need one value:

std::cout << app.userData().Username << '\n';

Before sign-in, and after sign-out, the copy is empty: u.empty() is true and the text fields are "".

Functions that return text, numbers and yes/no

Small helper functions keep your UI code tidy. Here are some you can copy.

Text:

std::string BuildTopLine()
{
auto u = app.userData();
if (u.empty() || u.LicenseKey.empty())
return " License: Null";
return " License: " + u.LicenseKey + " | Expiry: " + u.ExpiryDate;
}
std::string GetRemainingDays()
{
auto u = app.userData();
if (u.Subscription.empty())
return "N/A";
if (u.IsLifetime)
return "Lifetime";
if (u.DaysLeft > 0)
return std::to_string(u.DaysLeft) + "D";
if (!u.ExpiryDate.empty())
return u.ExpiryDate;
return "N/A";
}
std::string DisplayName()
{
auto u = app.userData();
return u.Username.empty() ? u.LicenseKey : u.Username;
}

Numbers:

int GetDaysLeft()
{
return app.userData().DaysLeft;
}
int GetDeviceLimit()
{
return app.userData().DeviceLimit;
}

Yes or no:

bool IsSignedIn()
{
return app.hasAccess();
}
bool IsLifetime()
{
return app.userData().IsLifetime;
}
bool ExpiresSoon()
{
auto u = app.userData();
return !u.IsLifetime && u.DaysLeft <= 3;
}
bool IsPremium()
{
return app.userData().Plan == "Premium";
}

Features and metadata

Features come from the plan and the account. Some are on/off, some carry a value such as "high" or 90. Metadata is extra information you attach to accounts, such as a Discord name or a level. See Features and metadata for how to set them up.

Read them from the account

The quickest way is from userData(). It does not contact AuthlyX, so you can use it anywhere, even every frame:

auto u = app.userData();
bool aim = u.HasFeature("aim");
std::string quality = u.Feature("quality");
int fov = u.FeatureInt("fov");
bool rainbow = u.FeatureBool("rainbow");
std::string discord = u.Meta("discord");
int level = u.MetaInt("level");
bool vip = u.MetaBool("vip");
HelperReturnsWhen missing
HasFeature(name)bool, true if this on/off feature is enabledfalse
Feature(name)std::string""
FeatureInt(name)int0
FeatureBool(name)boolfalse
Meta(name)std::string""
MetaInt(name)int0
MetaBool(name)boolfalse

Pass a second value to choose your own fallback:

int fov = app.userData().FeatureInt("fov", 90);
std::string theme = app.userData().Meta("theme", "dark");

None of these throw. Text such as "45" or "true" is converted when it can be, and yes, on and 1 count as true. The values refresh on every heartbeat, so a change you make in the dashboard shows up in the next userData() call without signing in again.

A feature function you can drop into a menu:

bool CanUse(const std::string& feature)
{
return app.hasAccess() && app.userData().HasFeature(feature);
}

Ask AuthlyX directly

These calls go to AuthlyX and return the current value from the server. Use them when you need to be sure the value is up to the second:

auto all = app.getFeatures().get();
std::cout << all.data["features"].dump() << '\n';
auto quality = app.getFeature("quality").get();
std::cout << quality.data["value"].dump() << '\n';
auto aim = app.checkFeature("aim").get();
bool enabled = aim.data.value("enabled", false);
auto everything = app.getAllMetadata().get();
std::cout << everything.data["metadata"].dump() << '\n';
auto discord = app.getMetadata("discord").get();
std::string name = discord.data.value("value", "");
auto vip = app.checkMetadata("vip").get();
bool isVip = vip.data.value("enabled", false);

result.data is an authlyx::json object (nlohmann/json). data["value"] gives you the raw JSON value, and data.value("value", fallback) gives it to you as the type of the fallback, or the fallback if it is missing. If the stored value has a different type, for example a number where you passed "", data.value throws nlohmann::json::type_error, so prefer the userData() helpers above when you just want a value. Like login, these calls throw authlyx::error when the request fails.

Save metadata

app.setMetadata("discord", "maya#1234").get();
app.setMetadata("level", 5).get();
app.setMetadata("vip", true).get();

Only keys you allowed for SDK writes in the dashboard can be changed this way.

Cloud variables

Cloud variables are values you store in the dashboard and read from your app, such as a download link or a message of the day. See Cloud variables.

auto motd = app.getVariable("motd").get();
std::string text = motd.data.value("value", "");
app.getVariable("motd", [](authlyx::result motd)
{
if (motd.ok())
std::cout << motd.data.value("value", "") << '\n';
});

To change a variable that you allowed the app to write:

app.updateVariable("last_build", "1.4.2").get();

A small helper that never throws:

std::string GetVariable(const std::string& name, const std::string& fallback = "")
{
try
{
return app.getVariable(name).get().data.value("value", fallback);
}
catch (const authlyx::error&)
{
return fallback;
}
}

Scripts

Scripts are signed text you store in the dashboard. The SDK checks the signature before giving it to you. It does not run the script; what you do with the text is up to you. See Scripts.

auto script = app.getScript("startup").get();
std::string content = script.data.value("content", "");

To get a specific revision instead of the newest:

auto older = app.getScript("startup", 3).get();

With a callback:

app.getScript("startup", [](authlyx::result script)
{
if (script.ok())
std::cout << script.data.value("content", "") << '\n';
});

Logs and webhooks

Send a line to your app’s logs in the dashboard:

app.log("Opened the settings page").get();

Send an event to your own server through a webhook you set up in the dashboard. The second value is any JSON:

app.sendWebhook("purchase.clicked", {{"item", "skin_42"}, {"price", 4.99}}).get();

If you do not need to wait for these, drop the .get(). The call still waits for its reply when the line ends, but you do not handle the result. To send without waiting at all, run it in a thread; see Threads and GUI apps.

Staying signed in

After sign-in the SDK keeps the session alive by itself. It checks in with AuthlyX in the background (a heartbeat), by default about every 10 minutes, and refreshes features and metadata each time. If you ban, pause or expire the account in the dashboard, the next heartbeat ends the session.

Check access

hasAccess() returns true while the user is signed in. It does not contact AuthlyX, so it is cheap enough for every frame:

if (!app.hasAccess())
{
ShowLoginScreen();
return;
}

Get told when access ends

Set on_invalidated to run code when AuthlyX ends the session, for example after a ban:

authlyx::options MakeOptions()
{
auto options = authlyx::defaultOptions("YOUR_APP_KEY", "1.0.0");
options.on_invalidated = [](const authlyx::error& reason)
{
MessageBoxA(nullptr, reason.what(), "Signed out", MB_OK);
ExitProcess(0);
};
options.on_connection = [](const std::string& state)
{
std::cout << "Connection: " << state << '\n';
};
return options;
}
AuthlyX app(MakeOptions());

on_connection receives online, disconnected or untrusted when the connection state changes. Both run on a background thread, so if you touch your UI from them, hand the work to your UI thread.

Check now

checkSession() checks in right away. onResume() is the same call, meant for when your app comes back from sleep or a long pause:

try
{
app.checkSession().get();
}
catch (const authlyx::error& e)
{
std::cout << e.what() << '\n';
}

To run the heartbeat yourself instead of letting the SDK do it, set options.heartbeat = "manual"; and call checkSession() from your own timer. Most apps should leave it automatic. More in Sessions and heartbeats.

Offline access

Offline access lets someone keep using your app for a while without internet, for example on a plane. You turn it on and set how long it lasts in the dashboard. See Offline access.

Save it after a successful online sign-in:

app.login(license).get();
app.saveOfflineAccess().get();

Later, without internet, init() returns OFFLINE_MODE (with ok() true), and the user signs in with the same license key or username and password. The SDK checks them against the saved permit and login returns the code OFFLINE_ACCESS. userData() works as normal; online-only calls such as getVariable fail until the connection comes back.

app.hasOfflineAccess() tells you whether this PC has a valid saved permit. Signing out deletes it.

Updates

When this version is not allowed, init() fails with UPDATE_REQUIRED or VERSION_MISMATCH, and the SDK shows a message box with the new version, its release notes and a button to open your download page. When a newer version exists but this one is still allowed, the SDK shows an Update available box once after sign-in.

To show your own window instead, turn the box off and read the update details from the result:

authlyx::options MakeOptions()
{
auto options = authlyx::defaultOptions("YOUR_APP_KEY", "1.0.0");
options.update_prompt = false;
return options;
}
std::string UpdateText(const authlyx::json& data, const char* field)
{
if (!data.is_object() || !data.contains("update") || !data["update"].is_object())
return "";
const auto& update = data["update"];
auto it = update.find(field);
return it != update.end() && it->is_string() ? it->get<std::string>() : "";
}
auto started = app.init().get();
if (started.code == "UPDATE_REQUIRED" || started.code == "VERSION_MISMATCH")
{
std::cout << started.message << '\n';
std::cout << "Latest version: " << UpdateText(started.data, "version") << '\n';
std::cout << "Download: " << UpdateText(started.data, "url") << '\n';
std::cout << UpdateText(started.data, "notes") << '\n';
}

The update details are version, url and notes. Any of them can be missing, which is why the helper checks before reading.

Set versions and download links under your app’s Updates settings. See Automatic updates.

Sign out

app.logout().get();

This ends the session on AuthlyX, clears userData() and deletes saved offline access on this PC. If there is no internet it still signs out locally and then throws a network error, so wrap it in try if you call .get().

When your program exits, the client shuts down by itself. To stop it earlier, call app.close(). After close() the client cannot be used again.

Threads and GUI apps

Every network call waits when you call .get(), and it also waits at the end of the line if you just call it. In a console app that is what you want. In a window, the wait has to happen somewhere other than the thread that draws the window.

Use callbacks

The simplest option. The call returns at once and your code runs when the reply arrives:

std::atomic<bool> busy(false);
std::string status;
std::mutex statusLock;
void OnLoginClicked(const std::string& license)
{
busy = true;
app.login(license, [](authlyx::result signedIn)
{
std::lock_guard<std::mutex> lock(statusLock);
status = signedIn.ok() ? "Welcome" : signedIn.message;
busy = false;
});
}

The callback runs on a background thread, so share data with your UI through an atomic or a mutex like above, and let your render loop pick it up.

Use your own thread

For calls that have no callback version, or when you want to run several steps in a row, start a thread:

void SignInInBackground(std::string license)
{
std::thread([license]
{
try
{
app.login(license).get();
app.saveOfflineAccess().get();
}
catch (const authlyx::error& e)
{
std::lock_guard<std::mutex> lock(statusLock);
status = e.what();
}
busy = false;
}).detach();
}

Callbacks exist for init, initialize, login (both forms), getVariable and getScript. Every other call works the same way inside a thread.

What is safe from any thread

  • userData(), hasAccess() and hasOfflineAccess(): safe on any thread at any time, including every frame of an ImGui loop.
  • Network calls: safe to start from any thread. The SDK sends them one at a time, so starting several at once is fine; they just queue.

An ImGui menu, for example, can read everything it shows directly:

void DrawAccountPanel()
{
auto u = app.userData();
ImGui::Text("License: %s", u.LicenseKey.c_str());
ImGui::Text("Plan: %s", u.Plan.c_str());
ImGui::Text("Time left: %s", GetRemainingDays().c_str());
if (u.HasFeature("esp"))
ImGui::Checkbox("ESP", &espEnabled);
}

Cancel a call

Pass a stop token as the last value of any network call. When you request a stop, that call fails with a cancelled error:

authlyx::stop_source cancel;
auto pending = app.getVariable("motd", cancel.get_token());
cancel.request_stop();

On C++20 these are the standard std::stop_source and std::stop_token.

Results and errors

Every call returns, or passes to your callback, an authlyx::result:

MemberTypeMeaning
ok()boolTrue when the call worked. success is the same value.
failed()boolThe opposite of ok()
codestd::stringFixed code such as APP_INITIALIZED or LICENSE_EXPIRED
messagestd::stringText you can show to the user
request_idstd::stringQuote this when you contact support
dataauthlyx::jsonThe call’s data, for example data["value"] for a variable
decode<T>()TConverts data into your own type with nlohmann/json

When .get() throws, you get an authlyx::error. It is a std::runtime_error, so catch (const std::exception&) also catches it:

MemberMeaning
what()Text you can show to the user
codeFixed code
kindserver, network, security, storage or cancelled
statusHTTP status, when there was one
request_idQuote this when you contact support
dataExtra details, such as update for version errors

Options

Start from authlyx::defaultOptions(appKey, version) and change what you need:

OptionDefaultWhat it does
app_key, versionFrom defaultOptionsYour AppKey and this build’s version
update_prompttrueShow the built-in update boxes
request_budget8 secondsHow long one call may take, including retries
heartbeat"server""manual" to run session checks yourself
on_invalidatedNoneRuns when AuthlyX ends the session
on_connectionNoneRuns when the connection state changes
build_hashEmptyThis build’s hash, if you use Application hashes
storageProtected files under %LOCALAPPDATA%\AuthlyX\v3Where the SDK keeps its protected state. Use std::make_shared<authlyx::windows_protected_store>(path) for another folder.
systemIdThe Windows user SIDThe ID that sign-ins are bound to
endpointhttps://api.authlyx.devLeave as it is

Common problems

has no member "ok" or has no member "message". You are holding the future. Add .get(): auto r = app.login(key).get();.

'auto' not allowed in lambda parameter. Your compiler is in C++11 mode. Write [](authlyx::result r) instead of [](auto r).

The window freezes when signing in. A .get() or a plain call is running on the UI thread. Use a callback or a thread.

class "AuthlyX" has no member "response" or no member Login. That is V2 code. V3 uses login, init and returned results. See Move from V2 to V3.

Sign-in fails with DEVICE_NOT_ALLOWED. The account is locked to another PC or Windows user. Reset its device in the dashboard.

The program builds slowly. Use AUTHLYX_SEPARATE_IMPLEMENTATION as shown in Add the SDK to your project.

A complete program

#include "AuthlyX.h"
#include <iostream>
#include <string>
AuthlyX app("YOUR_APP_KEY", "1.0.0");
std::string GetRemainingDays()
{
auto u = app.userData();
if (u.IsLifetime)
return "Lifetime";
return std::to_string(u.DaysLeft) + " days";
}
int main()
{
auto started = app.init().get();
if (!started.ok())
{
std::cout << started.message << '\n';
return 1;
}
std::string license;
std::cout << "License key: ";
std::getline(std::cin, license);
try
{
app.login(license).get();
}
catch (const authlyx::error& e)
{
std::cout << e.what() << '\n';
return 1;
}
auto u = app.userData();
std::cout << "Plan: " << u.Plan << '\n';
std::cout << "Time left: " << GetRemainingDays() << '\n';
if (u.HasFeature("beta"))
std::cout << "Beta features are on\n";
try
{
app.saveOfflineAccess().get();
}
catch (const authlyx::error&)
{
}
std::cout << "Press Enter to sign out";
std::cin.get();
try
{
app.logout().get();
}
catch (const authlyx::error&)
{
}
}

Each method also has its own page with every language side by side under SDK methods.