@@ -229,7 +229,7 @@ async def exchange_token_for_id_jag(
229229 # Add client authentication if needed
230230 if self .context .client_info :
231231 token_data ["client_id" ] = self .context .client_info .client_id
232- if self .context .client_info .client_secret :
232+ if self .context .client_info .client_secret is not None :
233233 token_data ["client_secret" ] = self .context .client_info .client_secret
234234
235235 try :
@@ -240,11 +240,11 @@ async def exchange_token_for_id_jag(
240240 )
241241
242242 if response .status_code != 200 :
243- error_data = (
243+ error_data : dict [ str , str ] = (
244244 response .json () if response .headers .get ("content-type" , "" ).startswith ("application/json" ) else {}
245245 )
246- error = error_data .get ("error" , "unknown_error" )
247- error_description = error_data .get ("error_description" , "Token exchange failed" )
246+ error : str = error_data .get ("error" , "unknown_error" )
247+ error_description : str = error_data .get ("error_description" , "Token exchange failed" )
248248 raise OAuthTokenError (f"Token exchange failed: { error } - { error_description } " )
249249
250250 # Parse response
@@ -299,7 +299,7 @@ async def exchange_id_jag_for_access_token(
299299 # Add client authentication
300300 if self .context .client_info :
301301 token_data ["client_id" ] = self .context .client_info .client_id
302- if self .context .client_info .client_secret :
302+ if self .context .client_info .client_secret is not None :
303303 token_data ["client_secret" ] = self .context .client_info .client_secret
304304
305305 try :
@@ -310,11 +310,11 @@ async def exchange_id_jag_for_access_token(
310310 )
311311
312312 if response .status_code != 200 :
313- error_data = (
313+ error_data : dict [ str , str ] = (
314314 response .json () if response .headers .get ("content-type" , "" ).startswith ("application/json" ) else {}
315315 )
316- error = error_data .get ("error" , "unknown_error" )
317- error_description = error_data .get ("error_description" , "JWT bearer grant failed" )
316+ error : str = error_data .get ("error" , "unknown_error" )
317+ error_description : str = error_data .get ("error_description" , "JWT bearer grant failed" )
318318 raise OAuthTokenError (f"JWT bearer grant failed: { error } - { error_description } " )
319319
320320 # Parse OAuth token response
0 commit comments