@@ -66,7 +66,7 @@ def __init__(
6666 transaction_identifier : str = "_a0_tx" ,
6767 state_identifier : str = "_a0_session" ,
6868 authorization_params : Optional [dict [str , Any ]] = None ,
69- pushed_authorization_requests : bool = False ,
69+ pushed_authorization_requests : bool = False
7070 ):
7171 """
7272 Initialize the Auth0 server client.
@@ -82,7 +82,6 @@ def __init__(
8282 transaction_identifier: Identifier for transaction data
8383 state_identifier: Identifier for state data
8484 authorization_params: Default parameters for authorization requests
85- pushed_authorization_requests: Whether to use PAR for authorization requests
8685 """
8786 if not secret :
8887 raise MissingRequiredArgumentError ("secret" )
@@ -163,8 +162,7 @@ async def start_interactive_login(
163162 # Build the transaction data to store
164163 transaction_data = TransactionData (
165164 code_verifier = code_verifier ,
166- app_state = options .app_state ,
167- audience = auth_params .get ("audience" , None ),
165+ app_state = options .app_state
168166 )
169167
170168 # Store the transaction data
@@ -299,7 +297,7 @@ async def complete_interactive_login(
299297
300298 # Build a token set using the token response data
301299 token_set = TokenSet (
302- audience = transaction_data . audience or "default" ,
300+ audience = token_response . get ( " audience" , "default" ) ,
303301 access_token = token_response .get ("access_token" , "" ),
304302 scope = token_response .get ("scope" , "" ),
305303 expires_at = int (time .time ()) +
@@ -571,12 +569,7 @@ async def get_session(self, store_options: Optional[dict[str, Any]] = None) -> O
571569 return session_data
572570 return None
573571
574- async def get_access_token (
575- self ,
576- audience : Optional [str ] = None ,
577- scope : Optional [str ] = None ,
578- store_options : Optional [dict [str , Any ]] = None
579- ) -> str :
572+ async def get_access_token (self , store_options : Optional [dict [str , Any ]] = None ) -> str :
580573 """
581574 Retrieves the access token from the store, or calls Auth0 when the access token
582575 is expired and a refresh token is available in the store.
@@ -595,10 +588,8 @@ async def get_access_token(
595588
596589 # Get audience and scope from options or use defaults
597590 auth_params = self ._default_authorization_params or {}
598- if not audience :
599- audience = auth_params .get ("audience" , "default" )
600- if not scope :
601- scope = auth_params .get ("scope" )
591+ audience = auth_params .get ("audience" , "default" )
592+ scope = auth_params .get ("scope" )
602593
603594 if state_data and hasattr (state_data , "dict" ) and callable (state_data .dict ):
604595 state_data_dict = state_data .dict ()
@@ -627,9 +618,7 @@ async def get_access_token(
627618 # Get new token with refresh token
628619 try :
629620 token_endpoint_response = await self .get_token_by_refresh_token ({
630- "refresh_token" : state_data_dict ["refresh_token" ],
631- "audience" : audience ,
632- "scope" : scope
621+ "refresh_token" : state_data_dict ["refresh_token" ]
633622 })
634623
635624 # Update state data with new token
@@ -1161,15 +1150,8 @@ async def get_token_by_refresh_token(self, options: dict[str, Any]) -> dict[str,
11611150 "client_id" : self ._client_id ,
11621151 }
11631152
1164- audience = options .get ("audience" )
1165- if audience :
1166- token_params ["audience" ] = audience
1167-
1168- # Add scope if present in options or the original authorization params
1169- scope = options .get ("scope" )
1170- if scope :
1171- token_params ["scope" ] = scope
1172- elif "scope" in self ._default_authorization_params :
1153+ # Add scope if present in the original authorization params
1154+ if "scope" in self ._default_authorization_params :
11731155 token_params ["scope" ] = self ._default_authorization_params ["scope" ]
11741156
11751157 # Exchange the refresh token for an access token
0 commit comments