Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions twilio/auth_strategy/token_auth_strategy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import jwt
import threading
import logging
from datetime import datetime
from datetime import datetime, timezone

from twilio.auth_strategy.auth_type import AuthType
from twilio.auth_strategy.auth_strategy import AuthStrategy
Expand Down Expand Up @@ -43,8 +43,8 @@ def is_token_expired(self, token):
if exp is None:
return True # No expiration time present, consider it expired

# Check if the expiration time has passed
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)

except jwt.DecodeError:
return True # Token is invalid
Expand Down