Skip to main content

Apple OAuth 2.0 / OAuth 2.1 / OIDC 1.0 identity provider implementations for Swarmauri

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_auth_idp_apple


Swarmauri Auth IDP Apple

Apple Sign-In OAuth 2.0, OAuth 2.1, and OIDC 1.0 flows packaged for the Swarmauri ecosystem.

Features

  • PKCE-enabled authorization code flows with signed state payloads to prevent tampering.
  • Automatic OpenID Connect discovery and JWKS verification for ID token integrity.
  • Reusable async HTTP client with retry and jitter to tolerate transient Apple API issues.
  • Typed, ComponentBase-derived classes that register with Swarmauri plugin discovery.
  • Explicit app-client stubs that document unsupported Apple client credentials grants.

Installation

pip

pip install swarmauri_auth_idp_apple

uv (project)

uv add swarmauri_auth_idp_apple

uv (environment)

uv pip install swarmauri_auth_idp_apple

Usage

The login classes expose the same asynchronous interface as the core IOAuth*Login contracts. Instantiate them with your Apple developer credentials, persist the state returned by auth_url, and provide it back during the exchange step.

from pydantic import SecretBytes
from swarmauri_auth_idp_apple import AppleOAuth21Login

login = AppleOAuth21Login(
    team_id="ABCD123456",
    key_id="XYZ7890",
    client_id="com.example.web",
    private_key_pem=SecretBytes(b"""-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"""),
    redirect_uri="https://example.com/callback",
    state_secret=SecretBytes(b"super-secret-state-key"),
)

# In your application, call `await login.auth_url()` to initiate the flow and
# `await login.exchange_and_identity(...)` inside an async context.
print(login.client_id)

Expected Workflow

  1. Call auth_url() and redirect the user-agent to the returned URL.
  2. Persist the state for later validation (cookie, session, encrypted store, etc.).
  3. On the redirect back to your service, validate the returned state and code by calling exchange_and_identity() (or exchange() for the OIDC login).
  4. Consume the normalized identity payload to provision sessions or tokens.

The package includes app-client classes which raise NotImplementedError to highlight that Apple does not support generic client credential grants for Sign in with Apple.

Entry Points

The distribution registers the following entry points:

  • swarmauri.auth_idp:AppleOAuth20Login
  • swarmauri.auth_idp:AppleOAuth21Login
  • swarmauri.auth_idp:AppleOIDC10Login
  • swarmauri.auth_idp:AppleOAuth20AppClient
  • swarmauri.auth_idp:AppleOAuth21AppClient
  • swarmauri.auth_idp:AppleOIDC10AppClient

Contributing

To contribute to swarmauri-sdk, review the guidelines for contributing which cover development workflow, testing, and coding standards.

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

swarmauri_auth_idp_apple-0.2.0.dev2.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

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

swarmauri_auth_idp_apple-0.2.0.dev2-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_auth_idp_apple-0.2.0.dev2.tar.gz.

File metadata

  • Download URL: swarmauri_auth_idp_apple-0.2.0.dev2.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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 swarmauri_auth_idp_apple-0.2.0.dev2.tar.gz
Algorithm Hash digest
SHA256 64e1b2d9ee0f472c02a00f2f77805d9f6ef4d251b91eeb50fcfced7b056c70d0
MD5 1ca7ce2d50a13fb3d091f5ba892a6b9e
BLAKE2b-256 0a65f1eeaf5cc249fbd7f86662ce2a3b8f17c6c3874aa2e58cc8ee443c7f0b75

See more details on using hashes here.

File details

Details for the file swarmauri_auth_idp_apple-0.2.0.dev2-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_auth_idp_apple-0.2.0.dev2-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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 swarmauri_auth_idp_apple-0.2.0.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 86d7507521c3533db491eaa1e2353351fa2df0c6d47143f4746542db021428f5
MD5 fa85242a02d5583b84523fae6397f337
BLAKE2b-256 eaa785f20a4663338806b3b5f06fe51cb11ed01eaad46d5c1406326fc6f3d223

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