GuideStep-by-Step
Full License Activation Flow
Implement a complete, production-ready license activation workflow in your desktop software, including hardware fingerprint extraction, seat validation, and error recovery.
Prerequisites
- An application created in the NineAuth Console.
- A valid
Client API Key(app_pub_live_*). - A generated license key (e.g. NINE-PRO-8891-2294-XXXX).
Activation Implementation
Send an activation request with the license key, end-user credentials, and computed HWID fingerprint:
import { NineAuthClient } from "@nineauth/sdk";
const client = new NineAuthClient({
apiKey: process.env.NINEAUTH_API_KEY!,
baseUrl: "https://api.nineauth.xyz",
});
async function activateLicense(licenseKey: string, email: string, pass: string) {
try {
const res = await client.licenses.activate({
licenseKey,
email,
password: pass,
hwid: "hwid_sha256_e3b0c442...",
});
console.log("License Activated! Plan:", res.license.plan);
console.log("Token to store in memory:", res.token);
return res;
} catch (err: any) {
if (err.code === "SEAT_LIMIT_EXCEEDED") {
console.error("No available seats left on this license.");
} else if (err.code === "LICENSE_EXPIRED") {
console.error("This license has expired.");
} else {
console.error("Activation failed:", err.message);
}
throw err;
}
}Common Error Codes
SEAT_LIMIT_EXCEEDED(403) — The maximum device seats for this tier are occupied.LICENSE_REVOKED(403) — License was invalidated by an admin.LICENSE_EXPIRED(403) — Validity period ended. Prompt user to renew.INVALID_CREDENTIALS(401) — Password verification failed.