Skip to content

Add OAuth client credentials support - #67

Merged
mzanoni merged 4 commits into
mainfrom
codex/add-oauth-support
Oct 22, 2026
Merged

mzanoni merged 4 commits into
mainfrom
codex/add-oauth-support

Conversation

@mzanoni

@mzanoni mzanoni commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

https://trello.com/c/qMBc4g9a/22758-java-sdk-add-support-for-oauth

Scope

  • Add server-side OAuth 2.0 client-credentials authentication while preserving all API-key constructors and behavior.
  • Acquire and cache dataset-scoped tokens with early renewal, concurrent acquisition sharing, interruption-safe abandonment, and one replay after a valid 401 Bearer invalid_token challenge.
  • Validate OAuth identifiers and HTTPS endpoints, safely parse token responses, and avoid leaking malformed response contents.
  • Add README guidance, focused unit coverage, and an opt-in live OAuth integration test.

Risk

  • Authentication request handling changes only for clients constructed with OAuth credentials; existing API-key authentication remains supported.
  • OAuth tokens are cached in memory per client/provider, so callers should reuse client instances.
  • Invalid-token recovery retries the serialized API request exactly once.

Validation

  • mvn --batch-mode -DskipTests package --file src/pom.xml — passed.
  • Focused Maven tests for OAuth challenge parsing, token-provider behavior, request replay, and construction validation — 28 passed.
  • Opt-in OAuthIntegrationTest compiled and skipped cleanly because live OAuth environment variables were absent.
  • git diff --check — passed.
  • Full legacy live tests were not run because DATASET_ID and API_KEY were unavailable.

Generation

  • Updated Generator/JavaClientWriter.cs and the four generated client outputs in lockstep.
  • The generator was not run because its wildcard Relewise.Client NuGet dependency could regenerate against the latest package rather than the current repository baseline.

@mzanoni
mzanoni requested a review from soe-relewise October 22, 2026 10:33

@soe-relewise soe-relewise left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please fix the malformed-token disclosure below. Also clarify the timeout behavior: unlike PHP, the configured timeout resets for each OAuth exchange.

Comment thread src/src/main/java/com/relewise/client/infrastructure/OAuthTokenProvider.java Outdated
@mzanoni
mzanoni requested a review from soe-relewise October 22, 2026 10:49

@soe-relewise soe-relewise left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Husk at bump 1.16.0->1.17.0 i src/pom.xml.

Image

@mzanoni
mzanoni merged commit 1a2fcd7 into main Oct 22, 2026
3 checks passed
@mzanoni
mzanoni deleted the codex/add-oauth-support branch October 22, 2026 11:00
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.

2 participants