Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token Expiration handling is broken, AirbyteAPI Fails is used after 3 minutes from creation #118

Closed
sheinbergon opened this issue Mar 16, 2025 · 3 comments
Assignees

Comments

@sheinbergon
Copy link

sheinbergon commented Mar 16, 2025

return Session(credentials=credentials, token=response_data.get("access_token"), scopes=scopes, expires_at=expires_at)

AirbyteAPI uses clientcredentials when calling do_token_request in order to generate temporary token for requests.
Looking at your code, you assume the expiration time by adding expires_in to the current time:

expires_at = None
if "expires_in" in response_data:
expires_at = int(time.time()) + response_data.get("expires_in")

However, the actuall expiration time encoded in the token (in exp) is different.

response_data['expires_in'] = 900 seconds -> expires_in = 1742088371 but exp field in the token is set to 1742087651 which makes for 720 seconds difference where the sdk will fail and token would remain invalid

Solution - you should derive expiration time from the decoded jwt, rather from the expires_in field, or adapt the expires_in to match what found in exp (set it to 180 seconds)

@sheinbergon sheinbergon changed the title Token Expiration exmination is broken, AirbyteAPI Fails is used after 3 minutes from creation Token Expiration handling is broken, AirbyteAPI Fails is used after 3 minutes from creation Mar 16, 2025
@bgroff
Copy link
Contributor

bgroff commented Mar 17, 2025

Sorry about this. The timeout was adjust on Friday, but it looks like the applications still have the old state. If you need to resolve this right now you can create a new application. Otherwise we will be fixing this ASAP.

@bgroff bgroff self-assigned this Mar 17, 2025
@sheinbergon
Copy link
Author

sheinbergon commented Mar 17, 2025

It's fine. I could workaround it by introducing airflow retries. I'm pretty sure this issue have been with us for quite some time though (judging by my airflow logs). Please let me know when the issue has been resolved 🙏 @bgroff

@bgroff
Copy link
Contributor

bgroff commented Mar 19, 2025

The values have been adjusted on our end. Going to close this issue, please reopen it if you experience further issues. Sorry for the inconvenience.

@bgroff bgroff closed this as completed Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants