Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_auth_idp_github Discord

Swarmauri Auth IDP GitHub

GitHub OAuth 2.0 / 2.1 logins and installation token helpers packaged for Swarmauri deployments.

Features

  • PKCE-enabled Authorization Code flows with HMAC-signed state payloads.
  • Token exchange helpers that return normalized identity payloads for downstream services.
  • Profile enrichment that fetches the authenticated user's primary verified email.
  • Installation access tokens for GitHub Apps with automatic caching and retry-aware HTTP.
  • ComponentBase-compatible models that register under swarmauri.auth_idp entry points.

Installation

pip

pip install swarmauri_auth_idp_github

uv (project)

uv add swarmauri_auth_idp_github

uv (environment)

uv pip install swarmauri_auth_idp_github

Usage

import asyncio
from pydantic import SecretBytes, SecretStr
from swarmauri_auth_idp_github import GitHubOAuth21Login

login = GitHubOAuth21Login(
    client_id="github-client-id",
    client_secret=SecretStr("github-client-secret"),
    redirect_uri="https://app.example.com/callback",
    state_secret=SecretBytes(b"replace-with-random-bytes"),
)

async def run_flow() -> None:
    auth = await login.auth_url()
    print(auth["url"])
    # Redirect the browser to `auth["url"]`, then capture the callback `code` and `state`.
    # Later, call `login.exchange_and_identity(code, state)` inside your callback handler.

asyncio.run(run_flow())

Workflow Summary

  1. Call auth_url() and redirect the browser to the returned URL.
  2. Persist the state and verify it during the callback handler.
  3. Exchange the authorization code through exchange_and_identity() to obtain tokens and profile metadata.
  4. Instantiate GitHubOAuth21AppClient to fetch GitHub App installation tokens when acting on behalf of repositories.

Entry Points

  • swarmauri.auth_idp:GitHubOAuth20Login
  • swarmauri.auth_idp:GitHubOAuth21Login
  • swarmauri.auth_idp:GitHubOAuth20AppClient
  • swarmauri.auth_idp:GitHubOAuth21AppClient

Contributing

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

Metadata

Release files for swarmauri_auth_idp_github 0.11.0.dev2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for swarmauri_auth_idp_github 0.11.0.dev2
File Size Uploaded
swarmauri_auth_idp_github-0.11.0.dev2.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for swarmauri_auth_idp_github 0.11.0.dev2
File Interpreter ABI Platform
swarmauri_auth_idp_github-0.11.0.dev2-py3-none-any.whl Python 3 none any Details

Total release size: 22.7 kB

Release files / swarmauri_auth_idp_github-0.11.0.dev2.tar.gz

Download URL swarmauri_auth_idp_github-0.11.0.dev2.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1fa006873bb0c9d3928a4741c1ae3d44e80df8aa58ba1114c76f2db938e4acea
BLAKE2b-256 checksum
How to use checksums
4706b3514cf11bcbfc719003dceefa611b7918778a775f61a52d399d47fc628d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}

Release files / swarmauri_auth_idp_github-0.11.0.dev2-py3-none-any.whl

Download URL swarmauri_auth_idp_github-0.11.0.dev2-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
def210b0b8483a09741171207f81c9cc83059dfdbfd74b7cfd662df9d1aa7654
BLAKE2b-256 checksum
How to use checksums
2995aed044c5168b5706a464bf8f7f1d12e5532e4a6732bfedbb50a9fe8e1597
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page