License Namespace
Sign in with a license key. The first sign-in locks the key to that PC.
Use this when
- Your customers type in a key. You sell or hand out keys and that is all they need. Use
Login(key). - Each key also has a username and password. This is the older mode. Use
Registeronce to attach them, thenLogin(user, password). - You want real user accounts with their own usernames, emailed codes and password reset? Use Account instead of this page.
Not sure which fits? Authentication Paths compares them.
Login with a key
Loginbool Login(const std::string& license_key);boolTrue when signed in. False otherwise: read Data::GetErrorMessage().// Sign in with a key. The first sign-in locks it to this PC.if (!Atlas::License::Login("ATLAS-A9F2K-4RMXM")) { std::cout << Atlas::Data::GetErrorMessage(); return 1;} // A key that has a username and password attached.if (!Atlas::License::Login("marcus.reyes", "Wp7#kLm2vQ")) return 1;Login with a username and password
Login (user)bool Login(const std::string& username, const std::string& password);Register. The lock to the PC works the same way.boolTrue when signed in.// Sign in with a key. The first sign-in locks it to this PC.if (!Atlas::License::Login("ATLAS-A9F2K-4RMXM")) { std::cout << Atlas::Data::GetErrorMessage(); return 1;} // A key that has a username and password attached.if (!Atlas::License::Login("marcus.reyes", "Wp7#kLm2vQ")) return 1;Register
Registerbool Register(const std::string& license_key, const std::string& username, const std::string& password);boolTrue when attached. It does not sign in. Call Login(user, password) next.// Attach a username and password to a key. This does not sign in.Atlas::License::Register("ATLAS-A9F2K-4RMXM", "marcus.reyes", "Wp7#kLm2vQ");Atlas::License::Login("marcus.reyes", "Wp7#kLm2vQ");When Login returns false
Read Data::GetErrorMessage() and show it to the user as it is. The usual causes:
- The key is wrong, expired or banned. The user needs another key, or you lift the ban on the dashboard.
- The key is locked to another PC. Use Reset hardware only on the dashboard (Licenses).
- This build of your app is not allowed. Add its hash on the dashboard (Settings, Builds). Every rebuild changes it.
- The server could not be reached. A network problem. Retry later.
After a successful sign-in
Background checks start by themselves: a session check every few seconds, a re-check of your app file, and a scan for hooks. You call nothing. If a check fails, the library ends the session and the process. A failed sign-in starts none of this and leaves no half-open session.
Sign-in windows (C++ only)
The C++ library can show the sign-in window for you. Each call blocks until the user closes it. JavaScript and Python have no windows: draw your own form and call the functions above.
// A window asks for the key, signs in, and closes on success.if (!Atlas::License::Dialog::Login()) return 1;if (!Atlas::License::Dialog::Register()) return 1;Same call in each language
| Method | C++ | JavaScript | Python | Returns |
|---|---|---|---|---|
| Login with a key | License::Login(key) | License.Login(key) | License.Login(key) | bool |
| Login with a username | License::Login(u, p) | License.LoginUser(u, p) | License.LoginUser(u, p) | bool |
| Register | License::Register(key, u, p) | License.Register(key, u, p) | License.Register(key, u, p) | bool |
| Dialog::Login | License::Dialog::Login() | - | - | window |
| Dialog::Register | License::Dialog::Register() | - | - | window |