Skip to main content

A library for building authentication systems using Authly.

Project description

Authly Python SDK

PyPI version Python versions License: MIT

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

authly_sdk-0.1.5b1.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

authly_sdk-0.1.5b1-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

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

Hashes for authly_sdk-0.1.5b1.tar.gz
Algorithm Hash digest
SHA256 94d1994bddf77a3830ca5effd889682433be3c33ae43624069bf996debaac040
MD5 506820adc7b5758b4668f40e47a705ae
BLAKE2b-256 5cc786699fff74222b89823714143f0dcd384ee012717521818620fabb0a3676

See more details on using hashes here.

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

Hashes for authly_sdk-0.1.5b1-py3-none-any.whl
Algorithm Hash digest
SHA256 709d04eedffdcef56f260bab09b95367b0d4640ef0292752d3932b70a1475c90
MD5 c6ab4ef00572a00638631b73c5008da8
BLAKE2b-256 0139a35fd19882135724fb37b315b75396c630298309082cba68fba2d3da7659

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page