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.4.tar.gz (10.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.4-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file authly_sdk-0.1.4.tar.gz.

File metadata

  • Download URL: authly_sdk-0.1.4.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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.4.tar.gz
Algorithm Hash digest
SHA256 ae8614f0c26ebae542c38e75786291e97463be3c70041c137d12062d2c224095
MD5 55d830853be7f8b2f19a144a9688e1a4
BLAKE2b-256 056ddccfe437f7979208588933d4921839bc29c63ef146756b1841a38479e9a6

See more details on using hashes here.

File details

Details for the file authly_sdk-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: authly_sdk-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1d2d2071f4f52765705740bc8e243bea66f58ae49206be6ae0be7706da309a6d
MD5 6a72364ee113a85f6e1de19e0be528dd
BLAKE2b-256 cad23ce40fb62beb7a9e4e3d34a58050ed4fc02d1b3a0673ff5973db8b56c9ef

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