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

OAuth2Client: defer initial token fetch when user interaction is required #8354

Merged
merged 3 commits into from Apr 18, 2024

Conversation

adutra
Copy link
Contributor

@adutra adutra commented Apr 18, 2024

Inspired by the ongoing discussion in #8347 and #8348 :

Currently the initial token fetch occurs when start() is called. This is fine for grant types that do not need user input and speeds up the process so that tokens are hopefully available when the client is actually used the first time.

But there are 2 issues with this "early start":

  • If user input is required, then a background thread will block waiting for the user; this thread cannot be interrupted.
  • In case the fetch fails, confusing log messages are printed in the console (confusing because they happen before the user tries to use the client).

This PR thus defers the initial token fetch in case of user interaction until the user actually attempts to use the client.

It also defers printing any log messages until the client has been accessed for the first time.

@adutra adutra changed the title OAUth2Client: defer initial token fetch when user interaction is required OAuth2Client: defer initial token fetch when user interaction is required Apr 18, 2024
@adutra adutra enabled auto-merge (squash) April 18, 2024 16:04
@adutra adutra merged commit e6451c1 into projectnessie:main Apr 18, 2024
16 checks passed
@adutra adutra deleted the oauth-defer-start branch April 18, 2024 16:31
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.

None yet

2 participants