@@ -1238,16 +1238,17 @@ def _acquire_token_silent_from_cache_and_possibly_refresh_it(
1238
1238
claims = _merge_claims_challenge_and_capabilities (
1239
1239
self ._client_capabilities , claims_challenge ),
1240
1240
)
1241
- if "error" not in response :
1242
- self .token_cache .add (dict (
1243
- client_id = self .client_id ,
1244
- scope = response ["scope" ].split () if "scope" in response else scopes ,
1245
- token_endpoint = self .authority .token_endpoint ,
1246
- response = response .copy (),
1247
- data = kwargs .get ("data" , {}),
1248
- _account_id = response ["_account_id" ],
1249
- ))
1250
- return _clean_up (response )
1241
+ if response : # It means broker was able to provide a decisive outcome
1242
+ if "error" not in response :
1243
+ self .token_cache .add (dict (
1244
+ client_id = self .client_id ,
1245
+ scope = response ["scope" ].split () if "scope" in response else scopes ,
1246
+ token_endpoint = self .authority .token_endpoint ,
1247
+ response = response .copy (),
1248
+ data = kwargs .get ("data" , {}),
1249
+ _account_id = response ["_account_id" ],
1250
+ ))
1251
+ return _clean_up (response ) # Then we use the broker's result
1251
1252
except ImportError :
1252
1253
logger .warning ("PyMsalRuntime is not available" )
1253
1254
result = _clean_up (self ._acquire_token_silent_by_finding_rt_belongs_to_me_or_my_family (
0 commit comments