Official Java SDK and console example for AuthlyX V3 (3.0.0 beta).
Full documentation: https://docs.authlyx.dev
- Windows
- Java 17 or newer
- Maven
Put your app key and version in src/main/java/app/authlyx/example/Main.java:
try (AuthlyX app = new AuthlyX("YOUR_APP_KEY", "1.0.0"))Then run it:
mvn compile exec:javaYou can find your app key under your app's credentials in the dashboard.
Copy src/main/java/app/authlyx/AuthlyX.java into your project and add these dependencies:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.22.4</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.86</version>
</dependency>import app.authlyx.AuthlyX;
try (AuthlyX app = new AuthlyX("YOUR_APP_KEY", "1.0.0")) {
app.initialize().join();
}Every method returns a CompletableFuture. Calling .join() waits for the reply, so in a Swing or JavaFX app do that off the UI thread, or use thenAccept.
app.login("YOUR_USERNAME", "YOUR_PASSWORD").join();
app.login("YOUR_LICENSE_KEY").join();
app.deviceLogin().join();Device login signs in the current Windows user without a form. The device has to be approved in your app first. See Device login.
After signing in, the account details are in userData:
var user = app.userData;
String username = user.path("name").asText("");
String plan = user.path("plan").asText("");
String expiry = user.path("expiry").asText("");Every method has its own page with examples under SDK methods.
Once someone is signed in, saving offline access stores a signed permit on that PC:
app.saveOfflineAccess().join();
boolean available = app.hasOfflineAccess().join();If they open your app later without internet, they sign in with the same username and password or license key, and the SDK checks it against the saved permit. Each permit belongs to one app and one account, and signing out removes it. More in Offline access.
When a request fails, the future completes with an AuthlyX.SdkException that has a code and a message you can show to the user. With .join() it arrives wrapped in a CompletionException, so read getCause() like the example does. All codes are listed in Errors.
V3 is a new SDK, not a drop-in update. Apps use an app key instead of the old owner ID, app name and secret, and the method names changed. Read Move from V2 to V3 before you switch.
MIT. See LICENSE.txt.