swarmauri_auth_idp_github 0.2.0.dev5__tar.gz → 0.11.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ swarmauri_auth_idp_github
2
+
3
+ Distribution: swarmauri_auth_idp_github
4
+ Repository: https://github.com/swarmauri/swarmauri-sdk
5
+
6
+ Author attribution: Jacob Stewart.
7
+ Licensed under Apache-2.0; see LICENSE.
@@ -0,0 +1,411 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_auth_idp_github
3
+ Version: 0.11.0
4
+ Summary: GitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ License-File: NOTICE
8
+ Keywords: swarmauri,sdk,experimental,identity,oauth2,oauth21,github,idp
9
+ Author: Jacob Stewart
10
+ Author-email: jacob@swarmauri.com
11
+ Requires-Python: >=3.10,<3.15
12
+ Classifier: Development Status :: 1 - Planning
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Natural Language :: English
15
+ Classifier: Topic :: Internet :: WWW/HTTP
16
+ Classifier: Topic :: Security :: Cryptography
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: 3.14
25
+ Requires-Dist: httpx (>=0.27)
26
+ Requires-Dist: pyjwt[crypto] (>=2.8)
27
+ Requires-Dist: swarmauri_base
28
+ Requires-Dist: swarmauri_core
29
+ Description-Content-Type: text/markdown
30
+
31
+ # swarmauri_auth_idp_github
32
+
33
+ <!-- readme-standards:begin branding -->
34
+ <p align="center"><a href="https://github.com/swarmauri/swarmauri-sdk"><img src="https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri.brand.theme.svg" alt="Swarmauri SDK" width="300"></a></p>
35
+ <p align="center"><strong>swarmauri_auth_idp_github</strong></p>
36
+ <p align="center">GitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri</p>
37
+ <p align="center">
38
+ <a href="https://pypi.org/project/swarmauri_auth_idp_github/"><img alt="pypi: swarmauri_auth_idp_github" src="https://img.shields.io/pypi/v/swarmauri_auth_idp_github?labelColor=1E293B&amp;color=1D4ED8"></a>
39
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml"><img alt="Source version: 0.11.0" src="https://img.shields.io/static/v1?label=Source%20version&amp;message=0.11.0&amp;labelColor=1E293B&amp;color=4338CA"></a>
40
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml"><img alt="Python: &gt;=3.10,&lt;3.15" src="https://img.shields.io/static/v1?label=Python&amp;message=%3E%3D3.10%2C%3C3.15&amp;labelColor=1E293B&amp;color=0F766E"></a>
41
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml"><img alt="Layer: standards" src="https://img.shields.io/static/v1?label=Layer&amp;message=standards&amp;labelColor=1E293B&amp;color=6D28D9"></a>
42
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/README.md#lifecycle-and-migration"><img alt="Lifecycle: active" src="https://img.shields.io/static/v1?label=Lifecycle&amp;message=active&amp;labelColor=1E293B&amp;color=166534"></a>
43
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/static/v1?label=License&amp;message=Apache-2.0&amp;labelColor=1E293B&amp;color=86198F"></a>
44
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/NOTICE"><img alt="Notice: attribution" src="https://img.shields.io/static/v1?label=Notice&amp;message=attribution&amp;labelColor=1E293B&amp;color=86198F"></a>
45
+ </p>
46
+ <p align="center">
47
+ <a href="https://pypi.org/project/swarmauri_auth_idp_github/"><img alt="Monthly PyPI downloads: swarmauri_auth_idp_github" src="https://img.shields.io/pypi/dm/swarmauri_auth_idp_github?labelColor=1E293B&amp;color=0E7490"></a>
48
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/README.md"><img alt="README hits: swarmauri_auth_idp_github" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/40-standards/swarmauri_auth_idp_github/README.md.svg?label=README%20hits&amp;labelColor=1E293B&amp;color=0E7490"></a>
49
+ </p>
50
+ <p align="center">
51
+ <a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="README standards: CI gate" src="https://img.shields.io/static/v1?label=README%20standards&amp;message=CI%20gate&amp;labelColor=1E293B&amp;color=1D4ED8"></a>
52
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/tests/unit/test_readme_sources.py"><img alt="Tests: example source" src="https://img.shields.io/static/v1?label=Tests&amp;message=example%20source&amp;labelColor=1E293B&amp;color=0F766E"></a>
53
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/README.md#certification-status"><img alt="Certification: not certified" src="https://img.shields.io/static/v1?label=Certification&amp;message=not%20certified&amp;labelColor=1E293B&amp;color=92400E"></a>
54
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"><img alt="Governance: repository policy" src="https://img.shields.io/static/v1?label=Governance&amp;message=repository%20policy&amp;labelColor=1E293B&amp;color=4338CA"></a>
55
+ <a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="Evidence: source and CI" src="https://img.shields.io/static/v1?label=Evidence&amp;message=source%20and%20CI&amp;labelColor=1E293B&amp;color=6D28D9"></a>
56
+ </p>
57
+ <p align="center"><a href="#overview">Overview</a> · <a href="#installation">Installation</a> · <a href="#quick-start">Quick Start</a> · <a href="#usage">Usage</a> · <a href="#public-api-and-import-surfaces">API</a> · <a href="#contributing">Contributing</a> · <a href="#governance">Governance</a> · <a href="#license">License</a></p>
58
+ <!-- readme-standards:end branding -->
59
+
60
+ ---
61
+
62
+ ## Overview
63
+
64
+ ### Summary
65
+
66
+ GitHub OAuth 2.0 / 2.1 logins and installation token helpers packaged for Swarmauri deployments.
67
+
68
+ ### Why This Package
69
+
70
+ `swarmauri_auth_idp_github` isolates this responsibility: GitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri. Its [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py) exposes `GitHubOAuth20AppClient`, `GitHubOAuth20Login`, `GitHubOAuth21AppClient`, `GitHubOAuth21Login`, allowing consumers to select this package without treating adjacent packages as part of its public contract.
71
+
72
+ ### When to Use
73
+
74
+ Choose `swarmauri_auth_idp_github` when your integration needs gitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri. Match the imports below to your application boundary and install its declared dependencies before using the example.
75
+
76
+ ### Features
77
+
78
+ - PKCE-enabled Authorization Code flows with HMAC-signed state payloads.
79
+ - Token exchange helpers that return normalized identity payloads for downstream services.
80
+ - Profile enrichment that fetches the authenticated user's primary verified email.
81
+ - Installation access tokens for GitHub Apps with automatic caching and retry-aware HTTP.
82
+ - ComponentBase-compatible models that register under `swarmauri.auth_idp` entry points.
83
+
84
+ ### Non-Goals
85
+
86
+ `swarmauri_auth_idp_github` owns gitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri. Its imports do not by themselves configure credentials, deploy a service, or certify the behavior of its consumers. Dependencies and neighboring packages retain their own documented responsibilities.
87
+
88
+ ---
89
+
90
+ ## Getting Started
91
+
92
+ ### Prerequisites
93
+
94
+ Python `>=3.10,<3.15` is required. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml) declares runtime dependencies including `swarmauri-core`, `swarmauri-base`, `httpx`, `pyjwt`. Read the example’s inputs and service requirements before execution.
95
+
96
+ ### Installation
97
+
98
+ **uv (project)**
99
+
100
+ ```bash
101
+ uv add swarmauri_auth_idp_github
102
+ ```
103
+
104
+ **uv (environment)**
105
+
106
+ ```bash
107
+ uv pip install swarmauri_auth_idp_github
108
+ ```
109
+
110
+ #### uv
111
+
112
+ <!-- readme-standards:begin installation.uv -->
113
+ ```bash
114
+ uv add swarmauri_auth_idp_github
115
+ ```
116
+ <!-- readme-standards:end installation.uv -->
117
+
118
+ #### pip
119
+
120
+ <!-- readme-standards:begin installation.pip -->
121
+ ```bash
122
+ python -m pip install swarmauri_auth_idp_github
123
+ ```
124
+ <!-- readme-standards:end installation.pip -->
125
+
126
+ ```bash
127
+ pip install swarmauri_auth_idp_github
128
+ ```
129
+
130
+ #### Poetry
131
+
132
+ <!-- readme-standards:begin installation.poetry -->
133
+ ```bash
134
+ poetry add swarmauri_auth_idp_github
135
+ ```
136
+ <!-- readme-standards:end installation.poetry -->
137
+
138
+ ### Quick Start
139
+
140
+ #### Example
141
+
142
+ <!-- readme-standards:begin example.quick-start -->
143
+ Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/docs/readme/quick_start.py).
144
+
145
+ ```python
146
+ import asyncio
147
+ from pydantic import SecretBytes, SecretStr
148
+ from swarmauri_auth_idp_github import GitHubOAuth21Login
149
+
150
+ login = GitHubOAuth21Login(
151
+ client_id="github-client-id",
152
+ client_secret=SecretStr("github-client-secret"),
153
+ redirect_uri="https://app.example.com/callback",
154
+ state_secret=SecretBytes(b"replace-with-random-bytes"),
155
+ )
156
+
157
+
158
+ async def run_flow() -> None:
159
+ auth = await login.auth_url()
160
+ print(auth["url"])
161
+ # Send the browser to the authorization URL and capture code and state.
162
+ # In the callback, pass code and state to exchange_and_identity.
163
+
164
+
165
+ asyncio.run(run_flow())
166
+ ```
167
+ <!-- readme-standards:end example.quick-start -->
168
+
169
+ #### Expected Result
170
+
171
+ The example demonstrates the documented `swarmauri_auth_idp_github` source boundary or workflow. Complete its required configuration first. README CI checks the maintained source’s syntax and declarations; it does not claim that external services or the application workflow were exercised.
172
+
173
+ ---
174
+
175
+ ## Usage
176
+
177
+ ### Common Workflows
178
+
179
+ <!-- readme-standards:begin example.usage -->
180
+ Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/docs/readme/usage.py).
181
+
182
+ ```python
183
+ import asyncio
184
+ from pydantic import SecretBytes, SecretStr
185
+ from swarmauri_auth_idp_github import GitHubOAuth21Login
186
+
187
+ login = GitHubOAuth21Login(
188
+ client_id="github-client-id",
189
+ client_secret=SecretStr("github-client-secret"),
190
+ redirect_uri="https://app.example.com/callback",
191
+ state_secret=SecretBytes(b"replace-with-random-bytes"),
192
+ )
193
+
194
+
195
+ async def run_flow() -> None:
196
+ auth = await login.auth_url()
197
+ print(auth["url"])
198
+ # Send the browser to the authorization URL and capture code and state.
199
+ # In the callback, pass code and state to exchange_and_identity.
200
+
201
+
202
+ asyncio.run(run_flow())
203
+ ```
204
+ <!-- readme-standards:end example.usage -->
205
+
206
+ 1. Call `auth_url()` and redirect the browser to the returned URL.
207
+ 2. Persist the `state` and verify it during the callback handler.
208
+ 3. Exchange the authorization code through `exchange_and_identity()` to obtain tokens and profile metadata.
209
+ 4. Instantiate `GitHubOAuth21AppClient` to fetch GitHub App installation tokens when acting on behalf of repositories.
210
+
211
+ ### Configuration
212
+
213
+ Configure `swarmauri_auth_idp_github` through the APIs in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py); its [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml) describes installation requirements, not an implicit service configuration. No additional package-global configuration contract is inferred from dependencies.
214
+
215
+ ### Error Handling
216
+
217
+ The inspected `swarmauri_auth_idp_github` source raises `ValueError`. Handle these at the calling boundary and consult the implementation for the triggering conditions.
218
+
219
+ ### Best Practices
220
+
221
+ Use the explicit `swarmauri_auth_idp_github` imports documented below and keep collaborator configuration with the caller. Run the package’s relevant tests after changing `GitHubOAuth20AppClient`, `GitHubOAuth20Login`, `GitHubOAuth21AppClient`, `GitHubOAuth21Login`; an import or successful installation alone does not establish its runtime guarantees.
222
+
223
+ ---
224
+
225
+ ## Package Boundary
226
+
227
+ ### What It Owns
228
+
229
+ `swarmauri_auth_idp_github` is located in `standards` and owns gitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri. Source-declared APIs include `GitHubOAuth20AppClient`, `GitHubOAuth20Login`, `GitHubOAuth21AppClient`, `GitHubOAuth21Login`. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml) records its direct dependency boundary.
230
+
231
+ ### Public API and Import Surfaces
232
+
233
+ Import namespace: `swarmauri_auth_idp_github`.
234
+
235
+ Source-declared exports or types: `GitHubOAuth20AppClient`, `GitHubOAuth20Login`, `GitHubOAuth21AppClient`, `GitHubOAuth21Login`.
236
+
237
+ Inspect [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py) for exact signatures; this inventory does not designate every internal module as stable.
238
+
239
+ ### Entry Points
240
+
241
+ <!-- readme-standards:begin entry-points -->
242
+ - `swarmauri.auth_idp` → `GitHubOAuth20AppClient` → `swarmauri_auth_idp_github:GitHubOAuth20AppClient`
243
+ - `swarmauri.auth_idp` → `GitHubOAuth20Login` → `swarmauri_auth_idp_github:GitHubOAuth20Login`
244
+ - `swarmauri.auth_idp` → `GitHubOAuth21AppClient` → `swarmauri_auth_idp_github:GitHubOAuth21AppClient`
245
+ - `swarmauri.auth_idp` → `GitHubOAuth21Login` → `swarmauri_auth_idp_github:GitHubOAuth21Login`
246
+ <!-- readme-standards:end entry-points -->
247
+
248
+ - `swarmauri.auth_idp:GitHubOAuth20Login`
249
+ - `swarmauri.auth_idp:GitHubOAuth21Login`
250
+ - `swarmauri.auth_idp:GitHubOAuth20AppClient`
251
+ - `swarmauri.auth_idp:GitHubOAuth21AppClient`
252
+
253
+ ### Injected Dependencies
254
+
255
+ The direct installation dependencies of `swarmauri_auth_idp_github` are `swarmauri-core`, `swarmauri-base`, `httpx`, `pyjwt`. These declarations do not imply automatic provider selection. Pass collaborators through the explicit constructors or call signatures in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py).
256
+
257
+ ### Protocol Consumers
258
+
259
+ No direct package-manifest dependency on `swarmauri_auth_idp_github` was found in the audited three-repository inventory. External consumers may still use its documented imports or commands.
260
+
261
+ ### Extensions
262
+
263
+ For `swarmauri_auth_idp_github`, use the source-declared public interfaces (`GitHubOAuth20AppClient`, `GitHubOAuth20Login`, `GitHubOAuth21AppClient`, `GitHubOAuth21Login`) when composing or extending behavior. Its entry-point section below is authoritative for registered plugins; no additional extension loader is inferred from the package name.
264
+
265
+ ---
266
+
267
+ ## Operations and Readiness
268
+
269
+ ### Operational Requirements
270
+
271
+ Operate `swarmauri_auth_idp_github` according to its actual entry points and collaborators. The dependency and Python requirements in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml) are prerequisites; deployment topology, credentials, and readiness remain the responsibility of the consuming application unless explicitly documented above.
272
+
273
+ ### Health and Observability
274
+
275
+ This README does not establish a standalone health endpoint for `swarmauri_auth_idp_github`. Observe the concrete caller’s results, exceptions, and existing test reports. An application that embeds this package must define its own health and telemetry contract.
276
+
277
+ ### Security and Resource Limits
278
+
279
+ Apply the input, credential, and resource constraints implemented in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py). The `swarmauri_auth_idp_github` README gate is a documentation check, not a security review or a substitute for the implementation’s limits and caller authorization.
280
+
281
+ ### Compatibility
282
+
283
+ This source version of `swarmauri_auth_idp_github` declares Python `>=3.10,<3.15`. Consult its dependency constraints before upgrading. Source-version and registry-version badges have separate meanings; this migration makes no additional platform or interoperability certification claim.
284
+
285
+ ---
286
+
287
+ ## Verification
288
+
289
+ ### Tests
290
+
291
+ Run `python -m pytest tests/unit/test_readme_sources.py` from the `swarmauri_auth_idp_github` package directory for the maintained example source checks (Python compilation and non-Python file presence). Existing package tests include:
292
+
293
+ - [tests/unit/test_github_oauth20_app_client_unit.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/tests/unit/test_github_oauth20_app_client_unit.py)
294
+ - [tests/unit/test_github_oauth20_login_unit.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/tests/unit/test_github_oauth20_login_unit.py)
295
+ - [tests/unit/test_github_oauth21_app_client_unit.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/tests/unit/test_github_oauth21_app_client_unit.py)
296
+ - [tests/unit/test_github_oauth21_login_unit.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/tests/unit/test_github_oauth21_login_unit.py)
297
+
298
+ The repository README gate also checks the required heading tree, metadata, managed fragments, and referenced files.
299
+
300
+ The package tests run fully offline. From the repository's `pkgs/` directory:
301
+
302
+ ```bash
303
+ uv run --package swarmauri_auth_idp_github --directory standards/swarmauri_auth_idp_github pytest
304
+ ```
305
+
306
+ The tests replace the HTTP client with a recording fake that replays canned
307
+ GitHub responses, and they sign GitHub App JWTs with a throwaway RSA key
308
+ generated at test time. No GitHub account, OAuth app, credentials, environment
309
+ secrets, or network access are required.
310
+
311
+ These tests verify the requests the adapter builds (URLs, methods, headers,
312
+ form fields, and JSON bodies) and how it shapes the returned identities and
313
+ tokens. The email fallback test records existing behavior: the adapter can
314
+ return an unverified address when no primary verified email is available.
315
+ They do not verify interoperability with live GitHub. Confirming live
316
+ provider support requires a manual run against a real GitHub OAuth app or
317
+ GitHub App installation.
318
+
319
+ ### Certification Status
320
+
321
+ No external certification is asserted for `swarmauri_auth_idp_github` by this documentation migration. README conformance, example syntax, runtime tests, and protocol or security certification are distinct evidence scopes.
322
+
323
+ ### Evidence
324
+
325
+ The [README standards CI](https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml) records mechanical documentation results for its tested commit. The [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py) and example sources support the package-boundary description; external runtime behavior requires its own test evidence.
326
+
327
+ ---
328
+
329
+ ## FAQ
330
+
331
+ ### Why
332
+
333
+ **Why select this package?** `swarmauri_auth_idp_github` provides gitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri; use its own API boundary rather than assuming neighboring packages are bundled or configured automatically.
334
+
335
+ ### How
336
+
337
+ **How do I start?** Install or synchronize the environment under Getting Started, follow the maintained example for `swarmauri_auth_idp_github`, and consult [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py) for the exact types and signatures involved.
338
+
339
+ ### When
340
+
341
+ **When should I validate an upgrade?** Recheck `swarmauri_auth_idp_github` whenever its source version, declared collaborators, configuration, or caller changes. Run relevant behavioral tests in addition to the README gate before promotion.
342
+
343
+ ---
344
+
345
+ ## Documentation and Related Packages
346
+
347
+ ### More Documentation
348
+
349
+ The [repository contribution guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md), [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py), and [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml) provide the supporting context for `swarmauri_auth_idp_github`. The [README policy](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md) defines the common document structure.
350
+
351
+ ### Related Packages
352
+
353
+ - [swarmauri_base](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/20-bases/swarmauri_base/README.md): Reusable Swarmauri base classes, mixins, and dynamic Pydantic component models for composable intelligence infrastructure.
354
+ - [swarmauri_core](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/10-interfaces/swarmauri_core/README.md): Core interface contracts and shared types for Swarmauri composable intelligence infrastructure components.
355
+
356
+ ### Project Links
357
+
358
+ <!-- readme-standards:begin project-links -->
359
+ - [pypi: swarmauri_auth_idp_github](https://pypi.org/project/swarmauri_auth_idp_github/)
360
+ <!-- readme-standards:end project-links -->
361
+
362
+ ---
363
+
364
+ ## Contributing
365
+
366
+ ### How to Contribute
367
+
368
+ To contribute to swarmauri-sdk, review the
369
+ [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
370
+ which cover development workflow, testing, and coding standards.
371
+
372
+ ### Development Setup
373
+
374
+ Work from the `pkgs/40-standards/swarmauri_auth_idp_github` checkout. Synchronize its declared development environment with uv, then run the relevant package tests and `python -m pytest tests/unit/test_readme_sources.py`. The repository’s dedicated README job installs `readme-standards==0.1.3` without resolving unrelated runtime packages.
375
+
376
+ ### Notes for Maintainers
377
+
378
+ Edit authored prose directly in this `swarmauri_auth_idp_github` README. Update source examples in `docs/readme/`, then run `readme-standards render --root . --write` from the package directory and review the diff. Required headings and generated blocks come from package-guide-v1.
379
+
380
+ ---
381
+
382
+ ## Governance
383
+
384
+ ### Ownership and Decision Making
385
+
386
+ Changes to `swarmauri_auth_idp_github` follow the maintainer review process of [swarmauri/swarmauri-sdk](https://github.com/swarmauri/swarmauri-sdk) and its contribution guide. Author attribution remains in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml); this README does not assign new publishing or administrative authority.
387
+
388
+ ### Standards and Policies
389
+
390
+ `swarmauri_auth_idp_github` follows the versioned [package-guide-v1 outline](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md). All fixed headings, hierarchy, order, separators, and package-specific branding are checked by CI; reviewers assess the accuracy and usefulness of authored claims.
391
+
392
+ ### Lifecycle and Migration
393
+
394
+ The `swarmauri_auth_idp_github` source version is `0.11.0`.
395
+
396
+ ---
397
+
398
+ ## License and Attribution
399
+
400
+ ### License
401
+
402
+ <!-- readme-standards:begin license -->
403
+ Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/LICENSE).
404
+ <!-- readme-standards:end license -->
405
+
406
+ ### Notices
407
+
408
+ <!-- readme-standards:begin notices -->
409
+ See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/NOTICE) for attribution.
410
+ <!-- readme-standards:end notices -->
411
+
@@ -0,0 +1,380 @@
1
+ # swarmauri_auth_idp_github
2
+
3
+ <!-- readme-standards:begin branding -->
4
+ <p align="center"><a href="https://github.com/swarmauri/swarmauri-sdk"><img src="https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri.brand.theme.svg" alt="Swarmauri SDK" width="300"></a></p>
5
+ <p align="center"><strong>swarmauri_auth_idp_github</strong></p>
6
+ <p align="center">GitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri</p>
7
+ <p align="center">
8
+ <a href="https://pypi.org/project/swarmauri_auth_idp_github/"><img alt="pypi: swarmauri_auth_idp_github" src="https://img.shields.io/pypi/v/swarmauri_auth_idp_github?labelColor=1E293B&amp;color=1D4ED8"></a>
9
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml"><img alt="Source version: 0.11.0" src="https://img.shields.io/static/v1?label=Source%20version&amp;message=0.11.0&amp;labelColor=1E293B&amp;color=4338CA"></a>
10
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml"><img alt="Python: &gt;=3.10,&lt;3.15" src="https://img.shields.io/static/v1?label=Python&amp;message=%3E%3D3.10%2C%3C3.15&amp;labelColor=1E293B&amp;color=0F766E"></a>
11
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml"><img alt="Layer: standards" src="https://img.shields.io/static/v1?label=Layer&amp;message=standards&amp;labelColor=1E293B&amp;color=6D28D9"></a>
12
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/README.md#lifecycle-and-migration"><img alt="Lifecycle: active" src="https://img.shields.io/static/v1?label=Lifecycle&amp;message=active&amp;labelColor=1E293B&amp;color=166534"></a>
13
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/static/v1?label=License&amp;message=Apache-2.0&amp;labelColor=1E293B&amp;color=86198F"></a>
14
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/NOTICE"><img alt="Notice: attribution" src="https://img.shields.io/static/v1?label=Notice&amp;message=attribution&amp;labelColor=1E293B&amp;color=86198F"></a>
15
+ </p>
16
+ <p align="center">
17
+ <a href="https://pypi.org/project/swarmauri_auth_idp_github/"><img alt="Monthly PyPI downloads: swarmauri_auth_idp_github" src="https://img.shields.io/pypi/dm/swarmauri_auth_idp_github?labelColor=1E293B&amp;color=0E7490"></a>
18
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/README.md"><img alt="README hits: swarmauri_auth_idp_github" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/40-standards/swarmauri_auth_idp_github/README.md.svg?label=README%20hits&amp;labelColor=1E293B&amp;color=0E7490"></a>
19
+ </p>
20
+ <p align="center">
21
+ <a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="README standards: CI gate" src="https://img.shields.io/static/v1?label=README%20standards&amp;message=CI%20gate&amp;labelColor=1E293B&amp;color=1D4ED8"></a>
22
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/tests/unit/test_readme_sources.py"><img alt="Tests: example source" src="https://img.shields.io/static/v1?label=Tests&amp;message=example%20source&amp;labelColor=1E293B&amp;color=0F766E"></a>
23
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/README.md#certification-status"><img alt="Certification: not certified" src="https://img.shields.io/static/v1?label=Certification&amp;message=not%20certified&amp;labelColor=1E293B&amp;color=92400E"></a>
24
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"><img alt="Governance: repository policy" src="https://img.shields.io/static/v1?label=Governance&amp;message=repository%20policy&amp;labelColor=1E293B&amp;color=4338CA"></a>
25
+ <a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="Evidence: source and CI" src="https://img.shields.io/static/v1?label=Evidence&amp;message=source%20and%20CI&amp;labelColor=1E293B&amp;color=6D28D9"></a>
26
+ </p>
27
+ <p align="center"><a href="#overview">Overview</a> · <a href="#installation">Installation</a> · <a href="#quick-start">Quick Start</a> · <a href="#usage">Usage</a> · <a href="#public-api-and-import-surfaces">API</a> · <a href="#contributing">Contributing</a> · <a href="#governance">Governance</a> · <a href="#license">License</a></p>
28
+ <!-- readme-standards:end branding -->
29
+
30
+ ---
31
+
32
+ ## Overview
33
+
34
+ ### Summary
35
+
36
+ GitHub OAuth 2.0 / 2.1 logins and installation token helpers packaged for Swarmauri deployments.
37
+
38
+ ### Why This Package
39
+
40
+ `swarmauri_auth_idp_github` isolates this responsibility: GitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri. Its [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py) exposes `GitHubOAuth20AppClient`, `GitHubOAuth20Login`, `GitHubOAuth21AppClient`, `GitHubOAuth21Login`, allowing consumers to select this package without treating adjacent packages as part of its public contract.
41
+
42
+ ### When to Use
43
+
44
+ Choose `swarmauri_auth_idp_github` when your integration needs gitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri. Match the imports below to your application boundary and install its declared dependencies before using the example.
45
+
46
+ ### Features
47
+
48
+ - PKCE-enabled Authorization Code flows with HMAC-signed state payloads.
49
+ - Token exchange helpers that return normalized identity payloads for downstream services.
50
+ - Profile enrichment that fetches the authenticated user's primary verified email.
51
+ - Installation access tokens for GitHub Apps with automatic caching and retry-aware HTTP.
52
+ - ComponentBase-compatible models that register under `swarmauri.auth_idp` entry points.
53
+
54
+ ### Non-Goals
55
+
56
+ `swarmauri_auth_idp_github` owns gitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri. Its imports do not by themselves configure credentials, deploy a service, or certify the behavior of its consumers. Dependencies and neighboring packages retain their own documented responsibilities.
57
+
58
+ ---
59
+
60
+ ## Getting Started
61
+
62
+ ### Prerequisites
63
+
64
+ Python `>=3.10,<3.15` is required. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml) declares runtime dependencies including `swarmauri-core`, `swarmauri-base`, `httpx`, `pyjwt`. Read the example’s inputs and service requirements before execution.
65
+
66
+ ### Installation
67
+
68
+ **uv (project)**
69
+
70
+ ```bash
71
+ uv add swarmauri_auth_idp_github
72
+ ```
73
+
74
+ **uv (environment)**
75
+
76
+ ```bash
77
+ uv pip install swarmauri_auth_idp_github
78
+ ```
79
+
80
+ #### uv
81
+
82
+ <!-- readme-standards:begin installation.uv -->
83
+ ```bash
84
+ uv add swarmauri_auth_idp_github
85
+ ```
86
+ <!-- readme-standards:end installation.uv -->
87
+
88
+ #### pip
89
+
90
+ <!-- readme-standards:begin installation.pip -->
91
+ ```bash
92
+ python -m pip install swarmauri_auth_idp_github
93
+ ```
94
+ <!-- readme-standards:end installation.pip -->
95
+
96
+ ```bash
97
+ pip install swarmauri_auth_idp_github
98
+ ```
99
+
100
+ #### Poetry
101
+
102
+ <!-- readme-standards:begin installation.poetry -->
103
+ ```bash
104
+ poetry add swarmauri_auth_idp_github
105
+ ```
106
+ <!-- readme-standards:end installation.poetry -->
107
+
108
+ ### Quick Start
109
+
110
+ #### Example
111
+
112
+ <!-- readme-standards:begin example.quick-start -->
113
+ Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/docs/readme/quick_start.py).
114
+
115
+ ```python
116
+ import asyncio
117
+ from pydantic import SecretBytes, SecretStr
118
+ from swarmauri_auth_idp_github import GitHubOAuth21Login
119
+
120
+ login = GitHubOAuth21Login(
121
+ client_id="github-client-id",
122
+ client_secret=SecretStr("github-client-secret"),
123
+ redirect_uri="https://app.example.com/callback",
124
+ state_secret=SecretBytes(b"replace-with-random-bytes"),
125
+ )
126
+
127
+
128
+ async def run_flow() -> None:
129
+ auth = await login.auth_url()
130
+ print(auth["url"])
131
+ # Send the browser to the authorization URL and capture code and state.
132
+ # In the callback, pass code and state to exchange_and_identity.
133
+
134
+
135
+ asyncio.run(run_flow())
136
+ ```
137
+ <!-- readme-standards:end example.quick-start -->
138
+
139
+ #### Expected Result
140
+
141
+ The example demonstrates the documented `swarmauri_auth_idp_github` source boundary or workflow. Complete its required configuration first. README CI checks the maintained source’s syntax and declarations; it does not claim that external services or the application workflow were exercised.
142
+
143
+ ---
144
+
145
+ ## Usage
146
+
147
+ ### Common Workflows
148
+
149
+ <!-- readme-standards:begin example.usage -->
150
+ Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/docs/readme/usage.py).
151
+
152
+ ```python
153
+ import asyncio
154
+ from pydantic import SecretBytes, SecretStr
155
+ from swarmauri_auth_idp_github import GitHubOAuth21Login
156
+
157
+ login = GitHubOAuth21Login(
158
+ client_id="github-client-id",
159
+ client_secret=SecretStr("github-client-secret"),
160
+ redirect_uri="https://app.example.com/callback",
161
+ state_secret=SecretBytes(b"replace-with-random-bytes"),
162
+ )
163
+
164
+
165
+ async def run_flow() -> None:
166
+ auth = await login.auth_url()
167
+ print(auth["url"])
168
+ # Send the browser to the authorization URL and capture code and state.
169
+ # In the callback, pass code and state to exchange_and_identity.
170
+
171
+
172
+ asyncio.run(run_flow())
173
+ ```
174
+ <!-- readme-standards:end example.usage -->
175
+
176
+ 1. Call `auth_url()` and redirect the browser to the returned URL.
177
+ 2. Persist the `state` and verify it during the callback handler.
178
+ 3. Exchange the authorization code through `exchange_and_identity()` to obtain tokens and profile metadata.
179
+ 4. Instantiate `GitHubOAuth21AppClient` to fetch GitHub App installation tokens when acting on behalf of repositories.
180
+
181
+ ### Configuration
182
+
183
+ Configure `swarmauri_auth_idp_github` through the APIs in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py); its [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml) describes installation requirements, not an implicit service configuration. No additional package-global configuration contract is inferred from dependencies.
184
+
185
+ ### Error Handling
186
+
187
+ The inspected `swarmauri_auth_idp_github` source raises `ValueError`. Handle these at the calling boundary and consult the implementation for the triggering conditions.
188
+
189
+ ### Best Practices
190
+
191
+ Use the explicit `swarmauri_auth_idp_github` imports documented below and keep collaborator configuration with the caller. Run the package’s relevant tests after changing `GitHubOAuth20AppClient`, `GitHubOAuth20Login`, `GitHubOAuth21AppClient`, `GitHubOAuth21Login`; an import or successful installation alone does not establish its runtime guarantees.
192
+
193
+ ---
194
+
195
+ ## Package Boundary
196
+
197
+ ### What It Owns
198
+
199
+ `swarmauri_auth_idp_github` is located in `standards` and owns gitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri. Source-declared APIs include `GitHubOAuth20AppClient`, `GitHubOAuth20Login`, `GitHubOAuth21AppClient`, `GitHubOAuth21Login`. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml) records its direct dependency boundary.
200
+
201
+ ### Public API and Import Surfaces
202
+
203
+ Import namespace: `swarmauri_auth_idp_github`.
204
+
205
+ Source-declared exports or types: `GitHubOAuth20AppClient`, `GitHubOAuth20Login`, `GitHubOAuth21AppClient`, `GitHubOAuth21Login`.
206
+
207
+ Inspect [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py) for exact signatures; this inventory does not designate every internal module as stable.
208
+
209
+ ### Entry Points
210
+
211
+ <!-- readme-standards:begin entry-points -->
212
+ - `swarmauri.auth_idp` → `GitHubOAuth20AppClient` → `swarmauri_auth_idp_github:GitHubOAuth20AppClient`
213
+ - `swarmauri.auth_idp` → `GitHubOAuth20Login` → `swarmauri_auth_idp_github:GitHubOAuth20Login`
214
+ - `swarmauri.auth_idp` → `GitHubOAuth21AppClient` → `swarmauri_auth_idp_github:GitHubOAuth21AppClient`
215
+ - `swarmauri.auth_idp` → `GitHubOAuth21Login` → `swarmauri_auth_idp_github:GitHubOAuth21Login`
216
+ <!-- readme-standards:end entry-points -->
217
+
218
+ - `swarmauri.auth_idp:GitHubOAuth20Login`
219
+ - `swarmauri.auth_idp:GitHubOAuth21Login`
220
+ - `swarmauri.auth_idp:GitHubOAuth20AppClient`
221
+ - `swarmauri.auth_idp:GitHubOAuth21AppClient`
222
+
223
+ ### Injected Dependencies
224
+
225
+ The direct installation dependencies of `swarmauri_auth_idp_github` are `swarmauri-core`, `swarmauri-base`, `httpx`, `pyjwt`. These declarations do not imply automatic provider selection. Pass collaborators through the explicit constructors or call signatures in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py).
226
+
227
+ ### Protocol Consumers
228
+
229
+ No direct package-manifest dependency on `swarmauri_auth_idp_github` was found in the audited three-repository inventory. External consumers may still use its documented imports or commands.
230
+
231
+ ### Extensions
232
+
233
+ For `swarmauri_auth_idp_github`, use the source-declared public interfaces (`GitHubOAuth20AppClient`, `GitHubOAuth20Login`, `GitHubOAuth21AppClient`, `GitHubOAuth21Login`) when composing or extending behavior. Its entry-point section below is authoritative for registered plugins; no additional extension loader is inferred from the package name.
234
+
235
+ ---
236
+
237
+ ## Operations and Readiness
238
+
239
+ ### Operational Requirements
240
+
241
+ Operate `swarmauri_auth_idp_github` according to its actual entry points and collaborators. The dependency and Python requirements in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml) are prerequisites; deployment topology, credentials, and readiness remain the responsibility of the consuming application unless explicitly documented above.
242
+
243
+ ### Health and Observability
244
+
245
+ This README does not establish a standalone health endpoint for `swarmauri_auth_idp_github`. Observe the concrete caller’s results, exceptions, and existing test reports. An application that embeds this package must define its own health and telemetry contract.
246
+
247
+ ### Security and Resource Limits
248
+
249
+ Apply the input, credential, and resource constraints implemented in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py). The `swarmauri_auth_idp_github` README gate is a documentation check, not a security review or a substitute for the implementation’s limits and caller authorization.
250
+
251
+ ### Compatibility
252
+
253
+ This source version of `swarmauri_auth_idp_github` declares Python `>=3.10,<3.15`. Consult its dependency constraints before upgrading. Source-version and registry-version badges have separate meanings; this migration makes no additional platform or interoperability certification claim.
254
+
255
+ ---
256
+
257
+ ## Verification
258
+
259
+ ### Tests
260
+
261
+ Run `python -m pytest tests/unit/test_readme_sources.py` from the `swarmauri_auth_idp_github` package directory for the maintained example source checks (Python compilation and non-Python file presence). Existing package tests include:
262
+
263
+ - [tests/unit/test_github_oauth20_app_client_unit.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/tests/unit/test_github_oauth20_app_client_unit.py)
264
+ - [tests/unit/test_github_oauth20_login_unit.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/tests/unit/test_github_oauth20_login_unit.py)
265
+ - [tests/unit/test_github_oauth21_app_client_unit.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/tests/unit/test_github_oauth21_app_client_unit.py)
266
+ - [tests/unit/test_github_oauth21_login_unit.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/tests/unit/test_github_oauth21_login_unit.py)
267
+
268
+ The repository README gate also checks the required heading tree, metadata, managed fragments, and referenced files.
269
+
270
+ The package tests run fully offline. From the repository's `pkgs/` directory:
271
+
272
+ ```bash
273
+ uv run --package swarmauri_auth_idp_github --directory standards/swarmauri_auth_idp_github pytest
274
+ ```
275
+
276
+ The tests replace the HTTP client with a recording fake that replays canned
277
+ GitHub responses, and they sign GitHub App JWTs with a throwaway RSA key
278
+ generated at test time. No GitHub account, OAuth app, credentials, environment
279
+ secrets, or network access are required.
280
+
281
+ These tests verify the requests the adapter builds (URLs, methods, headers,
282
+ form fields, and JSON bodies) and how it shapes the returned identities and
283
+ tokens. The email fallback test records existing behavior: the adapter can
284
+ return an unverified address when no primary verified email is available.
285
+ They do not verify interoperability with live GitHub. Confirming live
286
+ provider support requires a manual run against a real GitHub OAuth app or
287
+ GitHub App installation.
288
+
289
+ ### Certification Status
290
+
291
+ No external certification is asserted for `swarmauri_auth_idp_github` by this documentation migration. README conformance, example syntax, runtime tests, and protocol or security certification are distinct evidence scopes.
292
+
293
+ ### Evidence
294
+
295
+ The [README standards CI](https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml) records mechanical documentation results for its tested commit. The [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py) and example sources support the package-boundary description; external runtime behavior requires its own test evidence.
296
+
297
+ ---
298
+
299
+ ## FAQ
300
+
301
+ ### Why
302
+
303
+ **Why select this package?** `swarmauri_auth_idp_github` provides gitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri; use its own API boundary rather than assuming neighboring packages are bundled or configured automatically.
304
+
305
+ ### How
306
+
307
+ **How do I start?** Install or synchronize the environment under Getting Started, follow the maintained example for `swarmauri_auth_idp_github`, and consult [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py) for the exact types and signatures involved.
308
+
309
+ ### When
310
+
311
+ **When should I validate an upgrade?** Recheck `swarmauri_auth_idp_github` whenever its source version, declared collaborators, configuration, or caller changes. Run relevant behavioral tests in addition to the README gate before promotion.
312
+
313
+ ---
314
+
315
+ ## Documentation and Related Packages
316
+
317
+ ### More Documentation
318
+
319
+ The [repository contribution guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md), [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/swarmauri_auth_idp_github/__init__.py), and [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml) provide the supporting context for `swarmauri_auth_idp_github`. The [README policy](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md) defines the common document structure.
320
+
321
+ ### Related Packages
322
+
323
+ - [swarmauri_base](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/20-bases/swarmauri_base/README.md): Reusable Swarmauri base classes, mixins, and dynamic Pydantic component models for composable intelligence infrastructure.
324
+ - [swarmauri_core](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/10-interfaces/swarmauri_core/README.md): Core interface contracts and shared types for Swarmauri composable intelligence infrastructure components.
325
+
326
+ ### Project Links
327
+
328
+ <!-- readme-standards:begin project-links -->
329
+ - [pypi: swarmauri_auth_idp_github](https://pypi.org/project/swarmauri_auth_idp_github/)
330
+ <!-- readme-standards:end project-links -->
331
+
332
+ ---
333
+
334
+ ## Contributing
335
+
336
+ ### How to Contribute
337
+
338
+ To contribute to swarmauri-sdk, review the
339
+ [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
340
+ which cover development workflow, testing, and coding standards.
341
+
342
+ ### Development Setup
343
+
344
+ Work from the `pkgs/40-standards/swarmauri_auth_idp_github` checkout. Synchronize its declared development environment with uv, then run the relevant package tests and `python -m pytest tests/unit/test_readme_sources.py`. The repository’s dedicated README job installs `readme-standards==0.1.3` without resolving unrelated runtime packages.
345
+
346
+ ### Notes for Maintainers
347
+
348
+ Edit authored prose directly in this `swarmauri_auth_idp_github` README. Update source examples in `docs/readme/`, then run `readme-standards render --root . --write` from the package directory and review the diff. Required headings and generated blocks come from package-guide-v1.
349
+
350
+ ---
351
+
352
+ ## Governance
353
+
354
+ ### Ownership and Decision Making
355
+
356
+ Changes to `swarmauri_auth_idp_github` follow the maintainer review process of [swarmauri/swarmauri-sdk](https://github.com/swarmauri/swarmauri-sdk) and its contribution guide. Author attribution remains in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/pyproject.toml); this README does not assign new publishing or administrative authority.
357
+
358
+ ### Standards and Policies
359
+
360
+ `swarmauri_auth_idp_github` follows the versioned [package-guide-v1 outline](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md). All fixed headings, hierarchy, order, separators, and package-specific branding are checked by CI; reviewers assess the accuracy and usefulness of authored claims.
361
+
362
+ ### Lifecycle and Migration
363
+
364
+ The `swarmauri_auth_idp_github` source version is `0.11.0`.
365
+
366
+ ---
367
+
368
+ ## License and Attribution
369
+
370
+ ### License
371
+
372
+ <!-- readme-standards:begin license -->
373
+ Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/LICENSE).
374
+ <!-- readme-standards:end license -->
375
+
376
+ ### Notices
377
+
378
+ <!-- readme-standards:begin notices -->
379
+ See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/NOTICE) for attribution.
380
+ <!-- readme-standards:end notices -->
@@ -1,25 +1,26 @@
1
1
  [project]
2
2
  name = "swarmauri_auth_idp_github"
3
- version = "0.2.0.dev5"
3
+ version = "0.11.0"
4
4
  description = "GitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri"
5
5
  license = "Apache-2.0"
6
6
  readme = "README.md"
7
- requires-python = ">=3.10,<3.13"
7
+ requires-python = ">=3.10,<3.15"
8
8
  repository = "https://github.com/swarmauri/swarmauri-sdk"
9
9
  authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
10
10
  classifiers = [
11
11
  "Development Status :: 1 - Planning",
12
12
  "Intended Audience :: Developers",
13
- "License :: OSI Approved :: Apache Software License",
14
13
  "Natural Language :: English",
14
+ "Topic :: Internet :: WWW/HTTP",
15
+ "Topic :: Security :: Cryptography",
15
16
  "Programming Language :: Python",
16
17
  "Programming Language :: Python :: 3",
17
18
  "Programming Language :: Python :: 3 :: Only",
18
19
  "Programming Language :: Python :: 3.10",
19
20
  "Programming Language :: Python :: 3.11",
20
21
  "Programming Language :: Python :: 3.12",
21
- "Topic :: Internet :: WWW/HTTP",
22
- "Topic :: Security :: Cryptography",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Programming Language :: Python :: 3.14",
23
24
  ]
24
25
  keywords = [
25
26
  "swarmauri",
@@ -37,6 +38,7 @@ dependencies = [
37
38
  "httpx>=0.27",
38
39
  "pyjwt[crypto]>=2.8",
39
40
  ]
41
+ license-files = ["LICENSE", "NOTICE"]
40
42
 
41
43
  [project.entry-points.'swarmauri.auth_idp']
42
44
  GitHubOAuth20Login = "swarmauri_auth_idp_github:GitHubOAuth20Login"
@@ -67,6 +69,54 @@ log_cli_date_format = "%Y-%m-%d %H:%M:%S"
67
69
  asyncio_default_fixture_loop_scope = "function"
68
70
  addopts = "--pylicense-accept-deps=sniffio"
69
71
 
72
+ [tool.readme_standards]
73
+ policy = "package-guide-v1"
74
+ readme = "README.md"
75
+ brand = "swarmauri"
76
+ brand_catalog = "../../../tools/readme/brands.toml"
77
+ repository = "https://github.com/swarmauri/swarmauri-sdk"
78
+ ref = "master"
79
+ package_path = "pkgs/40-standards/swarmauri_auth_idp_github"
80
+ layer = "standards"
81
+ lifecycle = "active"
82
+ license_file = "LICENSE"
83
+ notice_file = "NOTICE"
84
+
85
+ [tool.readme_standards.distributions.pypi]
86
+ name = "swarmauri_auth_idp_github"
87
+ published = true
88
+
89
+ [tool.readme_standards.examples.quick_start]
90
+ source = "docs/readme/quick_start.py"
91
+ test = "tests/unit/test_readme_sources.py"
92
+ language = "python"
93
+ expected_exit_code = 0
94
+
95
+ [tool.readme_standards.examples.usage]
96
+ source = "docs/readme/usage.py"
97
+ test = "tests/unit/test_readme_sources.py"
98
+ language = "python"
99
+ expected_exit_code = 0
100
+
101
+ [tool.readme_standards.statuses.readme]
102
+ label = "CI gate"
103
+ url = "https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"
104
+
105
+ [tool.readme_standards.statuses.tests]
106
+ label = "example source"
107
+ url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/tests/unit/test_readme_sources.py"
108
+
109
+ [tool.readme_standards.statuses.certification]
110
+ label = "not certified"
111
+ url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_auth_idp_github/README.md#certification-status"
112
+
113
+ [tool.readme_standards.statuses.governance]
114
+ label = "repository policy"
115
+ url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"
116
+
117
+ [tool.readme_standards.statuses.evidence]
118
+ label = "source and CI"
119
+ url = "https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"
70
120
  [dependency-groups]
71
121
  dev = [
72
122
  "pytest>=8.0",
@@ -77,6 +127,7 @@ dev = [
77
127
  "pytest-benchmark>=4.0.0",
78
128
  "ruff>=0.9.9",
79
129
  "swarmauri_tests_pylicense",
130
+ "readme-standards==0.1.3; python_version >= \"3.11\"",
80
131
  ]
81
132
 
82
133
  [build-system]
@@ -42,7 +42,9 @@ class GitHubAppClientMixin:
42
42
  def _app_jwt(self) -> str:
43
43
  now = int(time.time())
44
44
  payload = {"iat": now - 60, "exp": now + 600, "iss": self.app_id}
45
- return jwt.encode(payload, self._private_key_value(), algorithm="RS256")
45
+ return jwt.encode(
46
+ payload, self._private_key_value(), algorithm="RS256"
47
+ )
46
48
 
47
49
  def _request_payload(self) -> Dict[str, Any]:
48
50
  payload: Dict[str, Any] = {}
@@ -51,7 +53,7 @@ class GitHubAppClientMixin:
51
53
  if self.repository_ids:
52
54
  payload["repository_ids"] = list(self.repository_ids)
53
55
  if self.repository_names:
54
- payload["repository_names"] = list(self.repository_names)
56
+ payload["repositories"] = list(self.repository_names)
55
57
  return payload
56
58
 
57
59
  @staticmethod
@@ -18,7 +18,9 @@ class GitHubOAuth20Login(GitHubOAuthLoginMixin, OAuth20LoginBase):
18
18
  payload = await self._auth_payload()
19
19
  return {"url": payload["url"], "state": payload["state"]}
20
20
 
21
- async def exchange_and_identity(self, code: str, state: str) -> Mapping[str, Any]:
21
+ async def exchange_and_identity(
22
+ self, code: str, state: str
23
+ ) -> Mapping[str, Any]:
22
24
  tokens = await self._exchange_tokens(code, state)
23
25
  profile = await self._fetch_profile(tokens["access_token"])
24
26
  return {
@@ -18,7 +18,9 @@ class GitHubOAuth21Login(GitHubOAuthLoginMixin, OAuth21LoginBase):
18
18
  payload = await self._auth_payload()
19
19
  return {"url": payload["url"], "state": payload["state"]}
20
20
 
21
- async def exchange_and_identity(self, code: str, state: str) -> Mapping[str, Any]:
21
+ async def exchange_and_identity(
22
+ self, code: str, state: str
23
+ ) -> Mapping[str, Any]:
22
24
  tokens = await self._exchange_tokens(code, state)
23
25
  profile = await self._fetch_profile(tokens["access_token"])
24
26
  return {
@@ -3,6 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from typing import Any, Callable, Mapping
6
+ from urllib.parse import parse_qsl, urlencode, urlsplit, urlunsplit
6
7
 
7
8
  from pydantic import ConfigDict, Field, SecretBytes, SecretStr
8
9
 
@@ -51,15 +52,45 @@ class GitHubOAuthLoginMixin:
51
52
  async def _auth_payload(self) -> Mapping[str, str]:
52
53
  verifier, challenge = make_pkce_pair()
53
54
  state = sign_state(self._state_secret_value(), {"verifier": verifier})
54
- url = (
55
- f"{self._authorization_endpoint()}?client_id={self.client_id}"
56
- f"&redirect_uri={self.redirect_uri}"
57
- f"&scope={self.scope}&state={state}"
58
- f"&code_challenge={challenge}&code_challenge_method=S256"
55
+ endpoint = self._authorization_endpoint()
56
+ params = {
57
+ "client_id": self.client_id,
58
+ "redirect_uri": self.redirect_uri,
59
+ "scope": self.scope,
60
+ "state": state,
61
+ "code_challenge": challenge,
62
+ "code_challenge_method": "S256",
63
+ }
64
+ query = urlencode(params)
65
+ parts = urlsplit(endpoint)
66
+ # An endpoint that already carries one of the generated keys (a stale
67
+ # state or PKCE value in its query) must not emit it twice: servers
68
+ # that take the first value or reject duplicates break the callback
69
+ # exchange. Other query keys the endpoint carries are kept.
70
+ kept = urlencode(
71
+ [
72
+ (key, value)
73
+ for key, value in parse_qsl(
74
+ parts.query, keep_blank_values=True
75
+ )
76
+ if key not in params
77
+ ]
78
+ )
79
+ merged_query = f"{kept}&{query}" if kept else query
80
+ url = urlunsplit(
81
+ (
82
+ parts.scheme,
83
+ parts.netloc,
84
+ parts.path,
85
+ merged_query,
86
+ parts.fragment,
87
+ )
59
88
  )
60
89
  return {"url": url, "state": state, "verifier": verifier}
61
90
 
62
- async def _exchange_tokens(self, code: str, state: str) -> Mapping[str, Any]:
91
+ async def _exchange_tokens(
92
+ self, code: str, state: str
93
+ ) -> Mapping[str, Any]:
63
94
  payload = verify_state(self._state_secret_value(), state)
64
95
  form = {
65
96
  "client_id": self.client_id,
@@ -108,7 +139,11 @@ class GitHubOAuthLoginMixin:
108
139
  None,
109
140
  )
110
141
  fallback = primary or next(
111
- (entry for entry in emails if isinstance(entry, Mapping)),
142
+ (
143
+ entry
144
+ for entry in emails
145
+ if isinstance(entry, Mapping)
146
+ ),
112
147
  None,
113
148
  )
114
149
  if fallback:
@@ -1,120 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: swarmauri_auth_idp_github
3
- Version: 0.2.0.dev5
4
- Summary: GitHub OAuth 2.0 / OAuth 2.1 identity provider implementations for Swarmauri
5
- License-Expression: Apache-2.0
6
- License-File: LICENSE
7
- Keywords: swarmauri,sdk,experimental,identity,oauth2,oauth21,github,idp
8
- Author: Jacob Stewart
9
- Author-email: jacob@swarmauri.com
10
- Requires-Python: >=3.10,<3.13
11
- Classifier: Development Status :: 1 - Planning
12
- Classifier: Intended Audience :: Developers
13
- Classifier: License :: OSI Approved :: Apache Software License
14
- Classifier: Natural Language :: English
15
- Classifier: Programming Language :: Python
16
- Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3 :: Only
18
- Classifier: Programming Language :: Python :: 3.10
19
- Classifier: Programming Language :: Python :: 3.11
20
- Classifier: Programming Language :: Python :: 3.12
21
- Classifier: Topic :: Internet :: WWW/HTTP
22
- Classifier: Topic :: Security :: Cryptography
23
- Requires-Dist: httpx (>=0.27)
24
- Requires-Dist: pyjwt[crypto] (>=2.8)
25
- Requires-Dist: swarmauri_base
26
- Requires-Dist: swarmauri_core
27
- Description-Content-Type: text/markdown
28
-
29
- ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/master/assets/swarmauri.brand.theme.svg)
30
-
31
- <p align="center">
32
- <a href="https://pypi.org/project/swarmauri_auth_idp_github/">
33
- <img src="https://img.shields.io/pypi/dm/swarmauri_auth_idp_github" alt="PyPI - Downloads"/></a>
34
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/experimental/swarmauri_auth_idp_github/">
35
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/experimental/swarmauri_auth_idp_github.svg"/></a>
36
- <a href="https://pypi.org/project/swarmauri_auth_idp_github/">
37
- <img src="https://img.shields.io/pypi/pyversions/swarmauri_auth_idp_github" alt="PyPI - Python Version"/></a>
38
- <a href="https://pypi.org/project/swarmauri_auth_idp_github/">
39
- <img src="https://img.shields.io/pypi/l/swarmauri_auth_idp_github" alt="PyPI - License"/></a>
40
- <a href="https://pypi.org/project/swarmauri_auth_idp_github/">
41
- <img src="https://img.shields.io/pypi/v/swarmauri_auth_idp_github?label=swarmauri_auth_idp_github&color=green" alt="PyPI - swarmauri_auth_idp_github"/></a>
42
- </p>
43
-
44
- ---
45
-
46
- # Swarmauri Auth IDP GitHub
47
-
48
- GitHub OAuth 2.0 / 2.1 logins and installation token helpers packaged for Swarmauri deployments.
49
-
50
- ## Features
51
-
52
- - PKCE-enabled Authorization Code flows with HMAC-signed state payloads.
53
- - Token exchange helpers that return normalized identity payloads for downstream services.
54
- - Profile enrichment that fetches the authenticated user's primary verified email.
55
- - Installation access tokens for GitHub Apps with automatic caching and retry-aware HTTP.
56
- - ComponentBase-compatible models that register under `swarmauri.auth_idp` entry points.
57
-
58
- ## Installation
59
-
60
- ### pip
61
-
62
- ```bash
63
- pip install swarmauri_auth_idp_github
64
- ```
65
-
66
- ### uv (project)
67
-
68
- ```bash
69
- uv add swarmauri_auth_idp_github
70
- ```
71
-
72
- ### uv (environment)
73
-
74
- ```bash
75
- uv pip install swarmauri_auth_idp_github
76
- ```
77
-
78
- ## Usage
79
-
80
- ```python
81
- import asyncio
82
- from pydantic import SecretBytes, SecretStr
83
- from swarmauri_auth_idp_github import GitHubOAuth21Login
84
-
85
- login = GitHubOAuth21Login(
86
- client_id="github-client-id",
87
- client_secret=SecretStr("github-client-secret"),
88
- redirect_uri="https://app.example.com/callback",
89
- state_secret=SecretBytes(b"replace-with-random-bytes"),
90
- )
91
-
92
- async def run_flow() -> None:
93
- auth = await login.auth_url()
94
- print(auth["url"])
95
- # Redirect the browser to `auth["url"]`, then capture the callback `code` and `state`.
96
- # Later, call `login.exchange_and_identity(code, state)` inside your callback handler.
97
-
98
- asyncio.run(run_flow())
99
- ```
100
-
101
- ### Workflow Summary
102
-
103
- 1. Call `auth_url()` and redirect the browser to the returned URL.
104
- 2. Persist the `state` and verify it during the callback handler.
105
- 3. Exchange the authorization code through `exchange_and_identity()` to obtain tokens and profile metadata.
106
- 4. Instantiate `GitHubOAuth21AppClient` to fetch GitHub App installation tokens when acting on behalf of repositories.
107
-
108
- ## Entry Points
109
-
110
- - `swarmauri.auth_idp:GitHubOAuth20Login`
111
- - `swarmauri.auth_idp:GitHubOAuth21Login`
112
- - `swarmauri.auth_idp:GitHubOAuth20AppClient`
113
- - `swarmauri.auth_idp:GitHubOAuth21AppClient`
114
-
115
- ## Contributing
116
-
117
- To contribute to swarmauri-sdk, review the
118
- [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
119
- which cover development workflow, testing, and coding standards.
120
-
@@ -1,91 +0,0 @@
1
- ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/master/assets/swarmauri.brand.theme.svg)
2
-
3
- <p align="center">
4
- <a href="https://pypi.org/project/swarmauri_auth_idp_github/">
5
- <img src="https://img.shields.io/pypi/dm/swarmauri_auth_idp_github" alt="PyPI - Downloads"/></a>
6
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/experimental/swarmauri_auth_idp_github/">
7
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/experimental/swarmauri_auth_idp_github.svg"/></a>
8
- <a href="https://pypi.org/project/swarmauri_auth_idp_github/">
9
- <img src="https://img.shields.io/pypi/pyversions/swarmauri_auth_idp_github" alt="PyPI - Python Version"/></a>
10
- <a href="https://pypi.org/project/swarmauri_auth_idp_github/">
11
- <img src="https://img.shields.io/pypi/l/swarmauri_auth_idp_github" alt="PyPI - License"/></a>
12
- <a href="https://pypi.org/project/swarmauri_auth_idp_github/">
13
- <img src="https://img.shields.io/pypi/v/swarmauri_auth_idp_github?label=swarmauri_auth_idp_github&color=green" alt="PyPI - swarmauri_auth_idp_github"/></a>
14
- </p>
15
-
16
- ---
17
-
18
- # Swarmauri Auth IDP GitHub
19
-
20
- GitHub OAuth 2.0 / 2.1 logins and installation token helpers packaged for Swarmauri deployments.
21
-
22
- ## Features
23
-
24
- - PKCE-enabled Authorization Code flows with HMAC-signed state payloads.
25
- - Token exchange helpers that return normalized identity payloads for downstream services.
26
- - Profile enrichment that fetches the authenticated user's primary verified email.
27
- - Installation access tokens for GitHub Apps with automatic caching and retry-aware HTTP.
28
- - ComponentBase-compatible models that register under `swarmauri.auth_idp` entry points.
29
-
30
- ## Installation
31
-
32
- ### pip
33
-
34
- ```bash
35
- pip install swarmauri_auth_idp_github
36
- ```
37
-
38
- ### uv (project)
39
-
40
- ```bash
41
- uv add swarmauri_auth_idp_github
42
- ```
43
-
44
- ### uv (environment)
45
-
46
- ```bash
47
- uv pip install swarmauri_auth_idp_github
48
- ```
49
-
50
- ## Usage
51
-
52
- ```python
53
- import asyncio
54
- from pydantic import SecretBytes, SecretStr
55
- from swarmauri_auth_idp_github import GitHubOAuth21Login
56
-
57
- login = GitHubOAuth21Login(
58
- client_id="github-client-id",
59
- client_secret=SecretStr("github-client-secret"),
60
- redirect_uri="https://app.example.com/callback",
61
- state_secret=SecretBytes(b"replace-with-random-bytes"),
62
- )
63
-
64
- async def run_flow() -> None:
65
- auth = await login.auth_url()
66
- print(auth["url"])
67
- # Redirect the browser to `auth["url"]`, then capture the callback `code` and `state`.
68
- # Later, call `login.exchange_and_identity(code, state)` inside your callback handler.
69
-
70
- asyncio.run(run_flow())
71
- ```
72
-
73
- ### Workflow Summary
74
-
75
- 1. Call `auth_url()` and redirect the browser to the returned URL.
76
- 2. Persist the `state` and verify it during the callback handler.
77
- 3. Exchange the authorization code through `exchange_and_identity()` to obtain tokens and profile metadata.
78
- 4. Instantiate `GitHubOAuth21AppClient` to fetch GitHub App installation tokens when acting on behalf of repositories.
79
-
80
- ## Entry Points
81
-
82
- - `swarmauri.auth_idp:GitHubOAuth20Login`
83
- - `swarmauri.auth_idp:GitHubOAuth21Login`
84
- - `swarmauri.auth_idp:GitHubOAuth20AppClient`
85
- - `swarmauri.auth_idp:GitHubOAuth21AppClient`
86
-
87
- ## Contributing
88
-
89
- To contribute to swarmauri-sdk, review the
90
- [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md)
91
- which cover development workflow, testing, and coding standards.