Skip to content

Latest commit

 

History

History
46 lines (30 loc) · 1.4 KB

File metadata and controls

46 lines (30 loc) · 1.4 KB

authplane-sdk

PyPI Python versions License

Framework-agnostic OAuth 2.1 JWT validation and token operations for Python resource servers.

Install

pip install authplane-sdk

Quickstart

import asyncio
from authplane import ASCredentials, AuthplaneClient


async def main():
    client = await AuthplaneClient.create(
        issuer="https://auth.example.com",
        auth=ASCredentials(client_id="my-resource", client_secret="s3cret"),
    )

    res = client.resource(
        resource="https://api.example.com",
        scopes=["read", "write"],
    )

    claims = await res.verify(incoming_jwt)
    print(claims.sub, claims.scopes)

    await client.aclose()


asyncio.run(main())

Call await client.aclose() on shutdown to stop background JWKS and metadata refresh tasks.

Documentation

Full API reference, configuration options, error hierarchy, DPoP, token operations, introspection, token exchange, and advanced usage: User Guide.