> This page is for version V3 - Beta (default).
> For other versions, use one of these documentation indexes:
> - V3 - Beta (default): https://docs.authlyx.dev/v3/llms.txt
> - V2 - Legacy: https://docs.authlyx.dev/v2/llms.txt
> - V1 - End of support: https://docs.authlyx.dev/v1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.authlyx.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.authlyx.dev/_mcp/server.

# Connect your first app

> Initialize an application and test a license login.

## 1. Get your AppKey

Open Applications in the dashboard, then open your app. Reveal and copy its V3 AppKey. Copy the version your program is running, such as `1.0.0`. You do not need the old owner ID, application name or application secret for V3 SDK initialization.

## 2. Add an SDK

Open the SDKs tab, choose your language and download the SDK ZIP. The download includes source and setup notes. Package names in those manifests do not mean the V3 package has already been published to a registry.

C# uses one SDK entry file, `AuthlyX.cs`. Add the dependencies listed in the example project and create a shared instance:

```csharp
using AuthlyXSDK;

public static AuthlyX app = new AuthlyX(
    appKey: "YOUR_APP_KEY",
    version: "1.0.0"
);
```

Put the field in your own application class. Your UI, console or service decides where to call it.

## 3. Initialize

```csharp
app.initialize(result =>
{
    statusLabel.Text = result.message;
    signInButton.Enabled = result.ok;
});
```

Here, `statusLabel` and `signInButton` represent your own UI controls. Initialization checks the application. It does not sign a customer in.

## 4. Sign in

Create a license in the dashboard and use it to test:

```csharp
app.login(licenseKey, result =>
{
    statusLabel.Text = result.message;
    if (result.ok)
        accountLabel.Text = app.userData.LicenseKey;
});
```

Run login after initialization succeeds. For username sign-in, use `login(username, password, callback)`. For an approved device, use `deviceLogin(callback)`.

## 5. Handle lost access

Subscribe to the SDK's invalidation event and lock your protected controls when access ends. Keep unsaved work available. The SDK does not close your application or decide which page to show.

## Check a failed connection

* The local API must be running on port 4000.
* A phone or another PC cannot reach your PC through its own `127.0.0.1` address.
* Default Windows examples use the real Windows user SID and protected Windows storage.
* On other platforms, supply a supported stable identifier and protected store through the SDK options. Do not replace those with a random identifier on every launch.
* The SDK must trust the signing keys of the API you are testing. Do not disable verification to make a request pass.