Fix timezone handling in OAuth state expiry check

Ensures that the expires_at field is compared as a UTC-aware datetime to prevent errors when checking if an OAuth state has expired.
This commit is contained in:
João Vitória Silva
2025-12-22 10:15:38 +00:00
parent 39eefd16cb
commit 43406a2e6d

View File

@@ -33,7 +33,7 @@ def get_oauth_state_by_id(
return None
# Check expiry
if datetime.now(timezone.utc) > oauth_state.expires_at:
if datetime.now(timezone.utc) > oauth_state.expires_at.replace(tzinfo=timezone.utc):
core_logger.print_to_log(f"OAuth state expired: {state_id[:8]}...", "warning")
return None