Skip to content

Add OAuth v3 client - #502

Merged
camden11 merged 2 commits into
masterfrom
feature/oauthV3
Oct 28, 2026
Merged

camden11 merged 2 commits into
masterfrom
feature/oauthV3

Conversation

@camden11

Copy link
Copy Markdown
Contributor

Why

The Python SDK has no client for the OAuth v3 token endpoints, so Python users can't move off the v1 token API. This adds HubSpot().oauth.v3.advanced_api with get_token, introspect_token, and revoke_token. It matches the Node client in HubSpot/hubspot-api-nodejs#702.

The second commit regenerates the client from an updated spec. The spec now declares no response body for revoke_token, so its return type changes from Error to None. In Python only the docstring :rtype changes; behavior is the same.

Notes for reviewers

  • Generated with openapi-generator python-legacy 6.5.0 and formatted with black 24.10.0 -l 200. Use that exact black version: black 26 changes docstring style.
  • Known gap: python-legacy merges each oneOf union into one class, which keeps only the last member's enum and required fields. With client_side_validation=True, every response raises ValueError on token_use. Client-side validation is off by default, as in the rest of the SDK.
  • client_credentials is untested: the test app gets BAD_SCOPES.

Testing

  • tests/spec/oauth/v3/test_v3.py covers discovery, plus deserialization for get_token and introspect_token. All of tests/spec passes (105/105).
  • QA against a test portal, run before the regeneration commit:
    • get_token with authorization_code and with refresh_token
    • a CRM call using the new token
    • introspection of access and refresh tokens
    • a bad token raising ApiException 400
    • revoke_token returning None, after which introspection reports active: false
  • A QA re-run on the regenerated client is in progress.

🤖 Generated with Claude Code

camden11 and others added 2 commits October 23, 2026 12:36
Exposes the OAuth v3 token endpoints (get, introspect, revoke) as
HubSpot().oauth.v3.advanced_api so Python users can move off the v1
token API, matching the Node client added in hubspot-api-nodejs#702.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The spec now declares revoke_token as returning no body, so the client
no longer tries to deserialize the empty 200 response as an Error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@camden11 camden11 mentioned this pull request Oct 27, 2026
@camden11
camden11 marked this pull request as ready for review October 27, 2026 18:14
@joe-yeager
joe-yeager self-requested a review October 27, 2026 18:46
@camden11
camden11 merged commit 5ec70d4 into master Oct 28, 2026
1 check passed
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