Using the Entitlement API in ObjectARX with C++
If you’re building native AutoCAD plugins using ObjectARX and C++, you can still leverage Autodesk’s Entitlement API for secure license management. In this post, you’ll learn how to invoke the API from C++ and handle tokens, HTTP requests, and error flows efficiently.

1. Why Use Entitlement in Native Plugins?
- Access API validation in secure compiled code
- Integrate licensing into native commands and menus
- Maintain consistency with .NET plugins
2. Set Up a Lightweight HTTP Client
ObjectARX doesn’t include built-in HTTP libraries, so you’ll need one like C++ REST SDK (Casablanca) or libcurl
.
Example with libcurl
:
#include <curl/curl.h>
#include <fstream>
bool ValidateToken(const std::string& token)
{
CURL* curl = curl_easy_init();
if (!curl) return false;
curl_easy_setopt(curl, CURLOPT_URL, "https://api.autodesk.com/entitlement/v1/validate");
struct curl_slist* headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
return (res == CURLE_OK);
}
3. Load Token from File
Store your test token in a local file:
std::string LoadToken()
{
std::ifstream in("license.token");
return std::string((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>());
}
4. Hook into Plugin Initialization
Register a command in your ARX entry point and validate on load:
ACED_ARXCOMMAND_ENTRY_AUTO(MyGroup, MyCommand, ValidateLicense, ValidateLicense, ACRX_CMD_MODAL, NULL)
void ValidateLicense()
{
std::string token = LoadToken();
if (ValidateToken(token))
acutPrintf("\nLicense valid. Plugin enabled.");
else
acutPrintf("\nLicense validation failed. Plugin disabled.");
}
5. Best Practices for C++ Integration
- Use HTTPS with strict validation (e.g. enable certificate pinning)
- Avoid token reuse across machines or long periods
- Handle
curl
errors for timeouts, 401/403 responses, and retry logic
Next Steps
In Post #6, we’ll explore how to implement floating licenses and trial logic, including time-based access and seat tracking.
Leveraging the Entitlement API with AutoLISP & .NET Hybrid
How to invoke Autodesk’s Entitlement API from AutoLISP scripts and integrate with a C#/.NET backend for seamless licensing workflows.
Security Best Practices & Cross-Product Licensing (Revit Case Study)
Learn how to secure your plugin’s licensing logic and how Revit and AutoCAD differ in their Entitlement API integration strategies.