We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f18c816 + 650748c commit 5424190Copy full SHA for 5424190
authlib/oauth2/rfc6749/wrappers.py
@@ -10,11 +10,13 @@ def __init__(self, params):
10
int(params['expires_in'])
11
super().__init__(params)
12
13
- def is_expired(self):
+ def is_expired(self, leeway=60):
14
expires_at = self.get('expires_at')
15
if not expires_at:
16
return None
17
- return expires_at < time.time()
+ # small timedelta to consider token as expired before it actually expires
18
+ expiration_threshold = expires_at - leeway
19
+ return expiration_threshold < time.time()
20
21
@classmethod
22
def from_dict(cls, token):
0 commit comments