8000
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.
1 parent 807f380 commit cdd9857Copy full SHA for cdd9857
twilio/auth_strategy/token_auth_strategy.py
@@ -1,7 +1,7 @@
1
import jwt
2
import threading
3
import logging
4
-from datetime import datetime
+from datetime import datetime, timezone
5
6
from twilio.auth_strategy.auth_type import AuthType
7
from twilio.auth_strategy.auth_strategy import AuthStrategy
@@ -43,8 +43,8 @@ def is_token_expired(self, token):
43
if exp is None:
44
return True # No expiration time present, consider it expired
45
46
- # Check if the expiration time has passed
47
- return datetime.fromtimestamp(exp) < datetime.utcnow()
+ # Check if the expiration time has passed by using time-zone
+ return datetime.fromtimestamp(exp, tz = timezone.utc) < datetime.now(timezone.utc)
48
49
except jwt.DecodeError:
50
return True # Token is invalid
0 commit comments