Skip to content

Commit d5cd692

Browse files
committed
Decide to completely disable RT removal
1 parent 26f0689 commit d5cd692

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

msal/application.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -926,12 +926,9 @@ def _acquire_token_silent_by_finding_specific_refresh_token(
926926
logger.debug("Cache attempts an RT")
927927
response = client.obtain_token_by_refresh_token(
928928
entry, rt_getter=lambda token_item: token_item["secret"],
929-
on_removing_rt=(rt_remover or self.token_cache.remove_rt)
930-
if # we can remove a RT when a single scope is an exact match
931-
len(scopes) == 1
932-
and set(entry.get("target", "").split()) <= set(scopes)
933-
else # otherwise keep the RT as it might work for a subset of scopes
934-
lambda rt_item: None, # No OP
929+
on_removing_rt=lambda rt_item: None, # Disable RT removal,
930+
# because an invalid_grant could be caused by new MFA policy,
931+
# the RT could still be useful for other MFA-less scope or tenant
935932
on_obtaining_tokens=lambda event: self.token_cache.add(dict(
936933
event,
937934
environment=authority.instance,

0 commit comments

Comments
 (0)