Skip to content

Commit 4af15fe

Browse files
committed
Pass issuer= in the remaining docstring examples and the story README
The PrivateKeyJWTOAuthProvider, static_assertion_provider and SignedJWTParameters examples now show the non-deprecated form, and the client-credentials story stops counting its config lines.
1 parent 04dafcb commit 4af15fe

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

examples/stories/oauth_client_credentials/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ the client and server side.
3333
- `client.py` `main` — opens with `async with Client(target, mode=mode) as
3434
client:` and that's the whole program. `target` is a transport that already
3535
carries the OAuth `httpx2.Auth`; the body never touches a token.
36-
- `client.py` `build_auth`five lines of `ClientCredentialsOAuthProvider`
37-
config is all the caller writes; the SDK does RFC 9728 PRM →
36+
- `client.py` `build_auth`a few lines of `ClientCredentialsOAuthProvider`
37+
config (credentials plus `issuer=`) is all the caller writes; the SDK does RFC 9728 PRM →
3838
RFC 8414 AS-metadata discovery and token exchange on the first 401.
3939
- `server.py` `token_endpoint` — the *entire* AS for this grant: validate
4040
HTTP-Basic `client_id:client_secret`, mint a token, return RFC 6749 JSON.

examples/stories/oauth_client_credentials/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
def build_auth(_http: httpx2.AsyncClient) -> httpx2.Auth:
17-
"""The ``httpx2.Auth`` for the ``client_credentials`` grant — six lines of provider config.
17+
"""The ``httpx2.Auth`` for the ``client_credentials`` grant — a few lines of provider config.
1818
1919
The SDK then handles 401 → RFC 9728 PRM → RFC 8414 AS-metadata discovery → token POST →
2020
Bearer attachment automatically. ``Client(url)`` has no ``auth=`` passthrough yet, so the

src/mcp/client/auth/extensions/client_credentials.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ def static_assertion_provider(token: str) -> Callable[[str], Awaitable[str]]:
180180
storage=my_token_storage,
181181
client_id="my-client-id",
182182
assertion_provider=static_assertion_provider(my_prebuilt_jwt),
183+
issuer="https://auth.example.com",
183184
)
184185
```
185186
@@ -214,6 +215,7 @@ class SignedJWTParameters(BaseModel):
214215
storage=my_token_storage,
215216
client_id="my-client-id",
216217
assertion_provider=jwt_params.create_assertion_provider(),
218+
issuer="https://auth.example.com",
217219
)
218220
```
219221
"""
@@ -279,6 +281,7 @@ async def get_workload_identity_token(audience: str) -> str:
279281
storage=my_token_storage,
280282
client_id="my-client-id",
281283
assertion_provider=get_workload_identity_token,
284+
issuer="https://auth.example.com",
282285
)
283286
```
284287
@@ -292,6 +295,7 @@ async def get_workload_identity_token(audience: str) -> str:
292295
storage=my_token_storage,
293296
client_id="my-client-id",
294297
assertion_provider=static_assertion_provider(my_prebuilt_jwt),
298+
issuer="https://auth.example.com",
295299
)
296300
```
297301
@@ -310,6 +314,7 @@ async def get_workload_identity_token(audience: str) -> str:
310314
storage=my_token_storage,
311315
client_id="my-client-id",
312316
assertion_provider=jwt_params.create_assertion_provider(),
317+
issuer="https://auth.example.com",
313318
)
314319
```
315320
"""

0 commit comments

Comments
 (0)