---
title: __init__
sidebarTitle: __init__
---

# `keycardai.oauth`


KeyCard AI OAuth SDK

A unified, developer-friendly Python SDK for OAuth 2.0 functionality implementing
multiple OAuth 2.0 standards with enterprise-ready features.

Supported OAuth 2.0 Standards:
- RFC 8693: OAuth 2.0 Token Exchange
- RFC 7591: OAuth 2.0 Dynamic Client Registration
- RFC 6750: OAuth 2.0 Bearer Token Usage
- RFC 8414: OAuth 2.0 Authorization Server Metadata

Example:
    # Simple usage
    from keycardai.oauth import AsyncClient, Client

    # Async client (primary implementation)
    async with AsyncClient("https://api.keycard.ai") as client:
        response = await client.exchange_token(
            subject_token="original_access_token",
            subject_token_type="urn:ietf:params:oauth:token-type:access_token",
            audience="target-service.company.com"
        )

    # Sync client (wrapper)
    with Client("https://api.keycard.ai") as client:
        response = client.exchange_token(
            subject_token="original_access_token",
            subject_token_type="urn:ietf:params:oauth:token-type:access_token",
            audience="target-service.company.com"
        )

