Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

feat: add proactive OAuth token fetching#1476

Open
majiayu000 wants to merge 1 commit intoTwiN:masterfrom
majiayu000:fix-672-is-there-a-way-to-proactively--0102-1053
Open

feat: add proactive OAuth token fetching#1476
majiayu000 wants to merge 1 commit intoTwiN:masterfrom
majiayu000:fix-672-is-there-a-way-to-proactively--0102-1053

Conversation

@majiayu000
Copy link

Fixes #672

Changes

  • Add proactive option to OAuth2Config for fetching tokens at client initialization
  • Token is fetched immediately during client configuration when enabled
  • Warning is logged if proactive fetch fails, but client continues normally

Usage

client:
  oauth2:
    token-url: https://example.com/oauth/token
    client-id: xxx
    client-secret: xxx
    scopes:
      - read
    proactive: true

Add a new `proactive` option to OAuth2Config that allows fetching
OAuth tokens at client initialization time rather than waiting for
the first HTTP request. This reduces latency on the first health
check when OAuth is configured.

When enabled via `proactive: true` in the oauth2 config block, the
token is fetched immediately during client configuration. If the
proactive fetch fails, a warning is logged but the client continues
normally (the regular flow will retry on the first request).

Fixes TwiN#672

Signed-off-by: majiayu000 <[email protected]>
@github-actions github-actions bot added the feature New feature or request label Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Is there a way to proactively fetch oauth tokens?

1 participant