Skip to content

feat(oauth): Add configurable token_refresh_request_type for GET-based OAuth APIs (AI-Triage PR)#919

Draft
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1772021224-oauth-token-refresh-request-type
Draft

feat(oauth): Add configurable token_refresh_request_type for GET-based OAuth APIs (AI-Triage PR)#919
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1772021224-oauth-token-refresh-request-type

Conversation

@devin-ai-integration
Copy link
Contributor

feat(oauth): Add configurable token_refresh_request_type for GET-based OAuth APIs

Summary

Adds a token_refresh_request_type property to OAuthAuthenticator that controls how the token refresh HTTP request is sent. Previously, the authenticator always used POST with a form-encoded body. Some APIs (e.g., Marketo's /identity/oauth/token) require GET with query parameters instead.

Three modes are now supported:

  • body_data (default): POST with form-encoded body — existing behavior, fully backward-compatible
  • body_json: POST with JSON body
  • query_params: GET with query parameters

The change threads through 5 files:

  1. abstract_oauth.py — new get_token_refresh_request_type() method + request dispatch logic in _make_handled_request()
  2. declarative_component_schema.yaml — new enum property in the OAuthAuthenticator schema
  3. declarative_component_schema.py — corresponding Pydantic model field (hand-edited)
  4. oauth.py (declarative auth) — dataclass field + getter override
  5. model_to_component_factory.py — wires the property when constructing the component

Resolves https://github.com/airbytehq/oncall/issues/11436:

Review & Testing Checklist for Human

  • Pydantic model generation: declarative_component_schema.py was hand-edited. Verify whether this file should instead be regenerated from the YAML schema (e.g., via poe assemble or a codegen script). The enum= kwarg passed to Field() may not enforce validation in Pydantic v2 — check that invalid values are actually rejected.
  • No input validation on request type: If an invalid string is passed as token_refresh_request_type, it silently falls through to the default body_data (POST form-encoded) branch. Consider whether an explicit error should be raised for unrecognized values.
  • No tests included: The three code paths in _make_handled_request() (query_params, body_json, body_data) have no unit test coverage. Recommend adding tests that mock requests.request and verify the correct HTTP method and parameter encoding for each mode.
  • Backward compatibility: Verify that existing connectors and manifests that do not set token_refresh_request_type behave identically to before (should default to body_data / POST with form-encoded body).

Notes

  • This PR was created as part of an AI Triage workflow for oncall issue airbytehq/oncall#11436
  • Requested by unknown () via Devin session
  • Lint and type checks pass locally (ruff check and mypy)
  • CI has not yet been verified — will monitor after PR creation

…d OAuth APIs

Add token_refresh_request_type property to OAuthAuthenticator supporting:
- body_data (default): POST with form-encoded body (standard OAuth2)
- body_json: POST with JSON body
- query_params: GET with query parameters (e.g., Marketo)

This unblocks Connector Builder users from building connectors for APIs
like Marketo that require GET requests to their OAuth token endpoint.

Changes:
- AbstractOauth2Authenticator: add get_token_refresh_request_type() and
  update _make_handled_request() to dispatch on request type
- DeclarativeOauth2Authenticator: thread through token_refresh_request_type
- declarative_component_schema.yaml: add token_refresh_request_type enum
- declarative_component_schema.py: add Pydantic field
- model_to_component_factory.py: wire through the new property

Co-Authored-By: unknown <>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions
Copy link

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

💡 Show Tips and Tricks

Testing This CDK Version

You can test this version of the CDK using the following:

# Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1772021224-oauth-token-refresh-request-type#egg=airbyte-python-cdk[dev]' --help

# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1772021224-oauth-token-refresh-request-type

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /autofix - Fixes most formatting and linting issues
  • /poetry-lock - Updates poetry.lock file
  • /test - Runs connector tests with the updated CDK
  • /prerelease - Triggers a prerelease publish with default arguments
  • /poe build - Regenerate git-committed build artifacts, such as the pydantic models which are generated from the manifest JSON schema in YAML.
  • /poe <command> - Runs any poe command in the CDK environment
📚 Show Repo Guidance

Helpful Resources

📝 Edit this welcome message.

@github-actions
Copy link

PyTest Results (Fast)

3 869 tests  ±0   3 857 ✅ ±0   6m 34s ⏱️ -17s
    1 suites ±0      12 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit fe97c73. ± Comparison against base commit 7f41401.

@github-actions
Copy link

PyTest Results (Full)

3 872 tests   3 860 ✅  11m 6s ⏱️
    1 suites     12 💤
    1 files        0 ❌

Results for commit fe97c73.

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.

0 participants