A library for building authentication systems using Authly.
Project description
Authly Python SDK
A lightweight and secure Python library for building authentication systems using Authly. This SDK provides simple tools to verify JWT tokens against Authly's identity provider.
Installation
Install using pip:
pip install authly-sdk
Or using uv:
uv add authly-sdk
Quick Start
from authly_sdk import AuthlyClient, TokenInvalidError, TokenExpiredError
# 1. Initialize the client
client = AuthlyClient(
issuer="https://auth.example.com",
audience="your-api-identifier"
)
# 2. Verify a token
try:
token = "eyJhbGciOiJSUzI1NiIs..."
claims = client.verify(token)
# Access standard and custom claims with full IDE support
print(f"User Subject: {claims['sub']}")
print(f"Session ID: {claims['sid']}")
print(f"Permissions: {claims['permissions']}")
except TokenExpiredError:
print("The token has expired")
except TokenInvalidError as e:
print(f"Invalid token: {e}")
Advanced Configuration
You can customize the JWKS path or allowed algorithms:
client = AuthlyClient(
issuer="https://auth.example.com",
audience="your-api",
jwks_path="/.well-known/jwks.json",
algorithms=["RS256"]
)
Development
We use uv for dependency management.
# Install dev dependencies
uv sync --dev
# Run type checks
uv run basedpyright src
# Format code
uv run ruff format .
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file authly_sdk-0.1.5b1.tar.gz.
File metadata
- Download URL: authly_sdk-0.1.5b1.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94d1994bddf77a3830ca5effd889682433be3c33ae43624069bf996debaac040
|
|
| MD5 |
506820adc7b5758b4668f40e47a705ae
|
|
| BLAKE2b-256 |
5cc786699fff74222b89823714143f0dcd384ee012717521818620fabb0a3676
|
File details
Details for the file authly_sdk-0.1.5b1-py3-none-any.whl.
File metadata
- Download URL: authly_sdk-0.1.5b1-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
709d04eedffdcef56f260bab09b95367b0d4640ef0292752d3932b70a1475c90
|
|
| MD5 |
c6ab4ef00572a00638631b73c5008da8
|
|
| BLAKE2b-256 |
0139a35fd19882135724fb37b315b75396c630298309082cba68fba2d3da7659
|