|
6 | 6 |
|
7 | 7 | import logging |
8 | 8 | from collections.abc import Awaitable, Callable |
| 9 | +from typing import cast |
9 | 10 |
|
10 | 11 | import httpx |
11 | 12 | import jwt |
12 | 13 | from pydantic import BaseModel, Field |
13 | 14 | from typing_extensions import TypedDict |
14 | 15 |
|
15 | 16 | from mcp.client.auth import OAuthClientProvider, OAuthFlowError, OAuthTokenError, TokenStorage |
16 | | -from mcp.shared.auth import OAuthClientMetadata, OAuthToken |
| 17 | +from mcp.shared.auth import OAuthClientMetadata |
17 | 18 |
|
18 | 19 | logger = logging.getLogger(__name__) |
19 | 20 |
|
@@ -330,9 +331,11 @@ async def exchange_id_jag_for_access_token( |
330 | 331 |
|
331 | 332 | # Apply client authentication method (handles client_secret_basic vs client_secret_post) |
332 | 333 | headers: dict[str, str] = {"Content-Type": "application/x-www-form-urlencoded"} |
333 | | - token_data, headers = self.context.prepare_token_auth(token_data, headers) |
| 334 | + # Cast to dict[str, str] for prepare_token_auth compatibility |
| 335 | + data_dict = cast(dict[str, str], token_data) |
| 336 | + data_dict, headers = self.context.prepare_token_auth(data_dict, headers) |
334 | 337 |
|
335 | | - return httpx.Request("POST", token_endpoint, data=token_data, headers=headers) |
| 338 | + return httpx.Request("POST", token_endpoint, data=data_dict, headers=headers) |
336 | 339 |
|
337 | 340 | async def _perform_authorization(self) -> httpx.Request: |
338 | 341 | """Perform enterprise authorization flow. |
|
0 commit comments