Skip to content

fix(key_flow): Add 5 second leeway to refresh access tokens early #2194

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

Merged
merged 9 commits into from
May 22, 2025

Conversation

ptrckmllr
Copy link
Contributor

@ptrckmllr ptrckmllr commented May 12, 2025

Description

This PR attempts to fix #2193

Checklist

  • Issue was linked above
  • No generated code was adjusted manually (check comments in file header)
  • Changelogs
    • Changelog in the root directory was adjusted (see here)
    • Changelog(s) of the service(s) were adjusted (see e.g. here)
  • Code format was applied: make fmt
  • Examples were added / adjusted (see examples/ directory)
  • Unit tests got implemented or updated
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@ptrckmllr
Copy link
Contributor Author

It seems this breaks the key_flow_continuous_refresh_test.go tests due to the extremly small token lifetimes used in there.

Is increasing token lifetimes (5+ seconds) in those tests a feasible approach?

@malteehrlen
Copy link
Contributor

thanks for this, we have been suffering expired tokens every now and then <3

@ptrckmllr
Copy link
Contributor Author

Moved the new variable to KeyFlow struct, set it during Init(...) and validate it.

Now the key_flow_continuous_refresh_test.go do work as expected again, as it uses the default 0 value.

This raises questions about the robustness of these tests though, as they do not call the KeyFlow.Init(...) func and instead just create the KeyFlow struct.

Should I create a separate issue or is this the intended way for the tests to run?

Copy link

This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it.

Copy link
Contributor

@Fyusel Fyusel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing!
Looks good, do you want to add the changelogs as well then this can be merged.

Regarding your open topic, I created a separate ticket on our side to have a look at this.

@ptrckmllr
Copy link
Contributor Author

Thank you for contributing! Looks good, do you want to add the changelogs as well then this can be merged.

Regarding your open topic, I created a separate ticket on our side to have a look at this.

Changelog has been updated.

ptrckmllr and others added 4 commits May 22, 2025 13:34
Co-authored-by: Alexander Dahmen <[email protected]>
Co-authored-by: Alexander Dahmen <[email protected]>
Co-authored-by: Alexander Dahmen <[email protected]>
Co-authored-by: Alexander Dahmen <[email protected]>
@Fyusel Fyusel merged commit 09ee10a into stackitcloud:main May 22, 2025
8 checks passed
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

Successfully merging this pull request may close these issues.

Access Tokens generated in Service Account Key client can be used too close to expiration time
4 participants