Commit 90ea95f
add OAuth mixin for transparent session handling in Client/AsyncClient
incorporates the best aspects of PR MarshalX#640's mixin approach while keeping our
async support, security module, and comprehensive test coverage.
**key changes:**
- add OAuthSessionMixin and AsyncOAuthSessionMixin to atproto_client
- integrate mixins into Client and AsyncClient classes
- override _invoke to transparently handle OAuth sessions with DPoP
- add oauth_login(), oauth_logout(), export_oauth_session() methods
- update codegen to auto-transform sync mixin to async
**usage:**
```python
from atproto_client import Client
from atproto_oauth import OAuthClient
# get OAuth session via OAuthClient (unchanged)
oauth_client = OAuthClient(...)
session = await oauth_client.handle_callback(code, state, iss)
# use with Client - requests are now transparently authenticated
client = Client(
oauth_client_id='https://myapp.com/client-metadata.json',
oauth_redirect_uri='https://myapp.com/callback',
oauth_scope='atproto',
)
client.oauth_login(session)
# all existing methods work with OAuth session
timeline = client.get_timeline()
```
**what this enables:**
- seamless integration: existing client methods work with OAuth sessions
- no manual DPoP proof generation for each request
- automatic nonce rotation on PDS requests
- session export/import for persistence
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent bd066ef commit 90ea95f
File tree
15 files changed
+573
-3
lines changed- docs/source/atproto
- packages
- atproto_client/client
- methods_mixin
- atproto_codegen/clients
- tests
15 files changed
+573
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
30 | 36 | | |
31 | 37 | | |
32 | 38 | | |
| |||
0 commit comments