@@ -431,7 +431,7 @@ def _get_token_endpoint(self) -> str:
431431 return token_url
432432
433433 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 = {}
435435 ) -> httpx .Request :
436436 """Build token exchange request for authorization_code flow."""
437437 if self .context .client_metadata .redirect_uris is None :
@@ -440,6 +440,7 @@ async def _exchange_token_authorization_code(
440440 raise OAuthFlowError ("Missing client info" )
441441
442442 token_url = self ._get_token_endpoint ()
443+ token_data = token_data or {}
443444 token_data .update (
444445 {
445446 "grant_type" : "authorization_code" ,
@@ -644,9 +645,10 @@ def __init__(
644645 self .jwt_parameters = jwt_parameters
645646
646647 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
648649 ) -> httpx .Request :
649650 """Build token exchange request for authorization_code flow."""
651+ token_data = token_data or {}
650652 if self .context .client_metadata .token_endpoint_auth_method == "private_key_jwt" :
651653 self ._add_client_authentication_jwt (token_data = token_data )
652654 return await super ()._exchange_token_authorization_code (auth_code , code_verifier , token_data = token_data )
0 commit comments