Skip to content

Commit

Permalink
fix: ensure OAuth token expiry only accepts seconds when no format sp…
Browse files Browse the repository at this point in the history
…ecified

Co-Authored-By: Aaron <AJ> Steers <[email protected]>
  • Loading branch information
devin-ai-integration[bot] and aaronsteers committed Jan 23, 2025
1 parent b970417 commit 6cb8071
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,11 @@ def _parse_token_expiration_date(self, value: Union[str, int]) -> AirbyteDateTim
return parse(str(value))
else:
try:
# Handle both integer and float seconds
# Only accept numeric values (as int/float/string) when no format specified
seconds = int(float(str(value)))
# For token expiry, we want to add the seconds to the current time
return add_seconds(now(), seconds)
except (ValueError, TypeError):
# If not a valid number of seconds, try parsing as a datetime string
dt = parse(str(value))
# If we successfully parsed a datetime, return it directly
return dt
raise ValueError(f"Invalid expires_in value: {value}. Expected number of seconds when no format specified.")

@property
def token_expiry_is_time_of_expiration(self) -> bool:
Expand Down

0 comments on commit 6cb8071

Please sign in to comment.