Skip to content

feat: OAuth bearer auth across all paths + removeBackground client (v1.2.0) - #9

Merged
vishal-genwave merged 5 commits into
mainfrom
integrate/token
Jul 17, 2026
Merged

feat: OAuth bearer auth across all paths + removeBackground client (v1.2.0)#9
vishal-genwave merged 5 commits into
mainfrom
integrate/token

Conversation

@vishal-genwave

@vishal-genwave vishal-genwave commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Objective

Add OAuth Bearer access-token support to the SDK so it can authenticate via a JWT (Authorization: Bearer) in addition to x-api-key. Also adds a new removeBackground client. Bumps to v1.2.0. The x-api-key path is unchanged.

Changes

  • Bearer auth across all paths. Added an accessToken config option; when set the SDK sends Authorization: Bearer instead of x-api-key. Completed it for form-data endpoints (edit, convert, remove-background) via a shared BaseClient.buildAuthHeaders() — the initial work only covered the JSON path, so form-data requests failed over bearer.
  • removeBackground client. c.removeBackground.configure({ file, svgText, storage, stream }).execute() → posts to /v1/remove-background, returns a transparent SVG. New types + core wiring + export.

Verified end-to-end via the MCP server over both stdio (api-key) and HTTP (bearer). No breaking changes.

- add accessToken client configuration option
- send Authorization: Bearer when accessToken is provided
- keep existing x-api-key authentication unchanged
- allow client initialization without an API key when using OAuth
…ints

Add a top-level removeBackground client (c.removeBackground) that posts
to /v1/remove-background and returns a transparent SVG, mirroring the
convert/aiVectorize builder (configure/execute + stream).

Complete OAuth bearer support for form-data endpoints: the earlier
accessToken work only reached the JSON path (HttpClient.buildHeaders),
so form-data requests (edit, convert, remove-background) still sent an
empty x-api-key and no Authorization header over bearer. Add a shared
BaseClient.buildAuthHeaders() (bearer when accessToken is set, else
x-api-key) and use it in executeFormDataRequest and the streaming path,
so all transports authenticate consistently.

- add RemoveBackgroundClient + RemoveBackground types + core wiring/export
- add BaseClient.buildAuthHeaders() and apply to form-data + stream paths
- bump version to 1.2.0
The get() methods bypassed handleRequest() with a raw fetch that hardcoded
x-api-key, so OAuth (Bearer) sessions sent no credential and got 401.
Use buildAuthHeaders() to match the working list/download paths.
@vishal-genwave
vishal-genwave merged commit ca1cd8f into main Jul 17, 2026
4 checks passed
@vishal-genwave
vishal-genwave deleted the integrate/token branch July 17, 2026 09:16
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.

1 participant