Skip to content

Only eval OAuth token getter once - #232

Open
Amolith wants to merge 3 commits into
Bandwidth:mainfrom
Amolith:only-fetch-once
Open

Amolith wants to merge 3 commits into
Bandwidth:mainfrom
Amolith:only-fetch-once

Conversation

@Amolith

@Amolith Amolith commented Oct 27, 2026

Copy link
Copy Markdown

The default OAuth token getter, when the token endpoint returns expires_in <= 60, can trigger four token acquisitions in the same request:

  • oauth_bearer_token calls access_token_with_refresh once to check for nil and again to construct the bearer header
    • Fixed by using the same token for both the nil check and the header
  • update_params_for_auth! rebuilds auth settings for each auth scheme, so the default Basic+OAuth2 then constructs the bearer header twice
    • Fixed by building auth settings once per request

So we don't eval access_token_with_refresh twice
So we don't construct the header twice
@Amolith
Amolith requested review from a team as code owners October 27, 2026 20:57
@bwappsec

bwappsec commented Oct 27, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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.

3 participants