Skip to content

Commit 4c8a026

Browse files
committed
2+ hrs AT will have refresh_in default to expires_in/2
1 parent 4b29298 commit 4c8a026

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

msal/token_cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ def __add(self, event, now=None):
187187
}
188188
if data.get("key_id"): # It happens in SSH-cert or POP scenario
189189
at["key_id"] = data.get("key_id")
190-
if "refresh_in" in response:
191-
refresh_in = response["refresh_in"] # It is an integer
190+
if "refresh_in" in response or expires_in > 7200:
191+
refresh_in = int(response.get("refresh_in", expires_in / 2))
192192
at["refresh_on"] = str(now + refresh_in) # Schema wants a string
193193
self.modify(self.CredentialType.ACCESS_TOKEN, at, at)
194194

0 commit comments

Comments
 (0)