GitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri
Project description
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_idpentry 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
- Call
auth_url()and redirect the browser to the returned URL. - Persist the
stateand verify it during the callback handler. - Exchange the authorization code through
exchange_and_identity()to obtain tokens and profile metadata. - Instantiate
GitHubOAuth21AppClientto fetch GitHub App installation tokens when acting on behalf of repositories.
Entry Points
swarmauri.auth_idp:GitHubOAuth20Loginswarmauri.auth_idp:GitHubOAuth21Loginswarmauri.auth_idp:GitHubOAuth20AppClientswarmauri.auth_idp:GitHubOAuth21AppClient
Contributing
To contribute to swarmauri-sdk, review the guidelines for contributing which cover development workflow, testing, and coding standards.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_auth_idp_github-0.2.0.dev5.tar.gz.
File metadata
- Download URL: swarmauri_auth_idp_github-0.2.0.dev5.tar.gz
- Upload date:
- Size: 9.3 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52bd57187241ab62ec5899105a4d70843e1f54ff48fcfafaff0031082623cd0a
|
|
| MD5 |
6d9f71d0686b45808526fb3387c3d1fb
|
|
| BLAKE2b-256 |
7111e4118ef456370bf600103da0c16ef63d34d3c72290dac203b854ffa75ebd
|
File details
Details for the file swarmauri_auth_idp_github-0.2.0.dev5-py3-none-any.whl.
File metadata
- Download URL: swarmauri_auth_idp_github-0.2.0.dev5-py3-none-any.whl
- Upload date:
- Size: 13.1 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9abb502705d9560029b038e2d914d0b5c6fb24c098cc5ea50883814c41fd02b4
|
|
| MD5 |
91d05628b765d02c63ae0bc83c43b45d
|
|
| BLAKE2b-256 |
34e5b95b41ced2d448ac92ad9c5c0befd3e22ac56b53e1d3c53554fcd39d5818
|