From 640d88a64a2a194f90ee6dd2621bc3bb3be263b9 Mon Sep 17 00:00:00 2001 From: Ray Luo Date: Tue, 2 Nov 2021 13:12:51 -0700 Subject: [PATCH] Bubble up refresh exception when we cannot recover --- msal/application.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/msal/application.py b/msal/application.py index 13015d09..05b77fc3 100644 --- a/msal/application.py +++ b/msal/application.py @@ -1207,7 +1207,9 @@ def _acquire_token_silent_from_cache_and_possibly_refresh_it( if (result and "error" not in result) or (not access_token_from_cache): return result except: # The exact HTTP exception is transportation-layer dependent - logger.exception("Refresh token failed") # Potential AAD outage? + # Typically network error. Potential AAD outage? + if not access_token_from_cache: # It means there is no fall back option + raise # We choose to bubble up the exception return access_token_from_cache def _acquire_token_silent_by_finding_rt_belongs_to_me_or_my_family(