Skip to content

About

AuthlyX Python (PY) Example & SDK

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

AuthlyX Python SDK

Official Python SDK and console example for AuthlyX V3 (3.0.0 beta).

Full documentation: https://docs.authlyx.dev

Requirements

  • Windows
  • Python 3.11 or newer

Run the example

Install the dependencies, then put your app key and version in main.py:

app = AuthlyX("YOUR_APP_KEY", "1.0.0")
pip install -r requirements.txt
python main.py

You can find your app key under your app's credentials in the dashboard.

Add it to your own project

Copy AuthlyX.py into your project and install aiohttp and cryptography from requirements.txt. If you'd rather install it as a package, use authlyx-api from PyPI.

import asyncio
from AuthlyX import AuthlyX

async def main():
    app = AuthlyX("YOUR_APP_KEY", "1.0.0")
    connected = await app.initialize()
    print("Connected" if connected.ok else connected.message)

asyncio.run(main())

Every method can be awaited. You can also pass completed= with a callback instead.

Signing in

await app.login("YOUR_USERNAME", "YOUR_PASSWORD")
await app.login("YOUR_LICENSE_KEY")
await app.deviceLogin()

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:

username = app.userData["Username"]
plan = app.userData["Plan"]
expiry = app.userData["ExpiryDate"]

Every method has its own page with examples under SDK methods.

Offline access

Once someone is signed in, saving offline access stores a signed permit on that PC:

saved = await app.saveOfflineAccess()
available = await app.hasOfflineAccess()

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.

Errors

A failed call gives you a code and a message you can show to the user. Network problems and some setup errors raise AuthlyXError instead, so wrap initialize() in try like the example does. All codes are listed in Errors.

Coming from 2.4

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.

License

MIT. See LICENSE.txt.

About

AuthlyX Python (PY) Example & SDK

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages