Skip to content

fix(python): fix OAuth token provider for custom parameter names#16275

Draft
iamnamananand996 wants to merge 1 commit into
mainfrom
devin/1780666692-fix-oauth-custom-params
Draft

fix(python): fix OAuth token provider for custom parameter names#16275
iamnamananand996 wants to merge 1 commit into
mainfrom
devin/1780666692-fix-oauth-custom-params

Conversation

@iamnamananand996
Copy link
Copy Markdown
Contributor

Description

Fixes the oauth-client-credentials-custom seed test failure by teaching the OAuth token provider generator to respect custom parameter name mappings and pass additional required parameters.

Changes Made

  • oauth_token_provider_generator.py:

    • Updated _get_constructor_parameters to accept client_credentials and generate constructor params for additional OAuth token endpoint parameters (scopes, required non-literal custom properties)
    • Added _is_literal_type / _is_optional_type helpers to distinguish auto-populated literal params from user-provided ones
    • Added _get_additional_oauth_params to extract (param_name, member_name) pairs for scopes and required custom properties
    • Updated _get_refresh_function_invocation to pass additional params as kwargs in the token refresh call
  • root_client_generator.py:

    • Added _get_additional_oauth_param_names mirror helper
    • Added additional OAuth params to root client constructor (as Optional[str] with None default for token-override compatibility)
    • Pass additional params through to OAuthTokenProvider instantiation in both standard and token-override code paths
    • Added assert statements to narrow types in the elif client_id is not None and client_secret is not None: branch
    • Updated constructor overload signatures and docstring to include additional params
  • seed.yml: Removed oauth-client-credentials-custom from allowedFailures

Testing

  • pnpm seed:local test --generator python-sdk --fixture oauth-client-credentials-custom → success
  • poetry run mypy . on generated output → Success: no issues found in 61 source files
  • poetry run pytest -rP -n auto .66 passed, 4 skipped
  • Verified oauth-client-credentials and oauth-client-credentials-openapi still pass (no code changes to those fixtures)

Link to Devin session: https://app.devin.ai/sessions/4e0c080d0e2a40bbb153fa05e4dd653d
Requested by: @iamnamananand996

Teach the OAuth token provider generator to:
- Use request-properties mapping for parameter names (e.g. cid/csr instead of client_id/client_secret)
- Accept and pass additional required parameters (scopes, non-literal custom properties)
- Filter out literal and optional custom properties that are auto-populated

Update root client generator to:
- Add additional OAuth params to constructor signatures and overloads
- Pass them through to OAuthTokenProvider instantiation
- Assert non-None in OAuth client credentials branch for type safety

Remove oauth-client-credentials-custom from allowedFailures.
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 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, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant