Skip to content

Add OAuth client credentials support - #230

Merged
mzanoni merged 8 commits into
mainfrom
codex/add-oauth-support
Oct 21, 2026
Merged

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

Conversation

@mzanoni

@mzanoni mzanoni commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

https://trello.com/c/RyptoX8f/22757-js-sdk-add-support-for-oauth

Scope

  • Add OAuth 2.0 client-credentials authentication to the shared @relewise/client base client.
  • Add token acquisition, caching, early renewal, concurrent acquisition sharing, and one retry for an invalid_token challenge.
  • Add OAuth constructor overloads to Tracker, Searcher, and Recommender while preserving the existing API-key signatures.
  • Add unit coverage, a live OAuth integration test, and usage documentation.
  • No new runtime dependencies.

Integrations support is split into the stacked PR #232.

Risk

  • Authentication and request dispatch in the shared base client.
  • Existing API-key behavior and constructor compatibility are covered by unit tests.

Validation

  • packages/client: npm run build
  • packages/client: npm run build:types
  • packages/client: npm test
  • GitHub Actions: test-sdk

The live OAuth test previously acquired a token successfully but received 403 until product-view permission was granted; it was not rerun with the exposed credential. The credential should be rotated.

API generation

  • npm run gen-api not run because no Swagger-generated contracts changed.

@mzanoni
mzanoni force-pushed the codex/add-oauth-support branch from 9bcbe5a to 5336b6c Compare October 21, 2026 10:36

@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 address the two P2 recovery issues below before merging: a stalled shared token acquisition has no SDK-controlled lifetime, and empty authentication-list elements prevent invalid_token recovery. Both were reproduced against this commit and independently validated by three reviewers.

The separate P3 comment about sanitizing malformed token responses is defensive hardening, not a reason for requesting changes on its own.

Validation: all 113 client unit tests, npm run build, and npm run build:types passed locally using the installed tooling. Focused checks reproduced the additional cases below. Live OAuth integration tests were not run. PHP PR #86 provides useful existing examples of bounded acquisition and empty-list handling.

Comment thread packages/client/src/oauthTokenProvider.ts
Comment thread packages/client/src/oauthChallenge.ts
Comment thread packages/client/src/oauthTokenProvider.ts Outdated
@mzanoni
mzanoni requested a review from soe-relewise October 21, 2026 12:54

@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.

Image

@mzanoni
mzanoni merged commit cb6ed69 into main Oct 21, 2026
4 checks passed
@mzanoni
mzanoni deleted the codex/add-oauth-support branch October 21, 2026 13:19
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