@@ -431,7 +431,7 @@ def _get_token_endpoint(self) -> str:
431
431
return token_url
432
432
433
433
async def _exchange_token_authorization_code (
434
- self , auth_code : str , code_verifier : str , * , token_data : dict [str , Any ] = {}
434
+ self , auth_code : str , code_verifier : str , * , token_data : dict [str , Any ] | None = {}
435
435
) -> httpx .Request :
436
436
"""Build token exchange request for authorization_code flow."""
437
437
if self .context .client_metadata .redirect_uris is None :
@@ -440,6 +440,7 @@ async def _exchange_token_authorization_code(
440
440
raise OAuthFlowError ("Missing client info" )
441
441
442
442
token_url = self ._get_token_endpoint ()
443
+ token_data = token_data or {}
443
444
token_data .update (
444
445
{
445
446
"grant_type" : "authorization_code" ,
@@ -644,9 +645,10 @@ def __init__(
644
645
self .jwt_parameters = jwt_parameters
645
646
646
647
async def _exchange_token_authorization_code (
647
- self , auth_code : str , code_verifier : str , * , token_data : dict [str , Any ] = {}
648
+ self , auth_code : str , code_verifier : str , * , token_data : dict [str , Any ] | None = None
648
649
) -> httpx .Request :
649
650
"""Build token exchange request for authorization_code flow."""
651
+ token_data = token_data or {}
650
652
if self .context .client_metadata .token_endpoint_auth_method == "private_key_jwt" :
651
653
self ._add_client_authentication_jwt (token_data = token_data )
652
654
return await super ()._exchange_token_authorization_code (auth_code , code_verifier , token_data = token_data )
0 commit comments