Skip to content

Fix OAuth2 PKCE Implementation Issues#19

Merged
tcaldwell-x merged 2 commits into
mainfrom
fix-oauth2-bugs
Dec 2, 2025
Merged

Fix OAuth2 PKCE Implementation Issues#19
tcaldwell-x merged 2 commits into
mainfrom
fix-oauth2-bugs

Conversation

@tcaldwell-x
Copy link
Copy Markdown
Contributor

Problem

OAuth2 PKCE flows were broken due to:

  • Python SDK: Incorrect authorization URL, wrong token endpoint path, outdated base URLs, and documentation errors
  • TypeScript SDK: PKCE parameters not being included in authorization URL

Solution

  • Python SDK: Hardcode authorization URL to https://x.com/i/oauth2/authorize, fix token endpoint to /2/oauth2/token, update default base_url to https://api.x.com, and correct all documentation examples
  • TypeScript SDK: Include PKCE parameters (code_challenge, code_challenge_method) in authorization URL when set

Changes

  • python/oauth2_auth.j2: Fix authorization URL, token endpoint path, and default base_url
  • python/main_client.j2: Update default base_url
  • python/process_for_mintlify.j2: Fix documentation examples (imports, parameters, method usage)
  • typescript/oauth2_auth.j2: Add PKCE parameters to authorization URL

Impact

  • OAuth2 PKCE flows now work correctly in both SDKs
  • Documentation examples are accurate and functional
  • No breaking changes - these are bug fixes that correct incorrect behavior

Testing

  • Verify OAuth2 PKCE authorization flow completes successfully
  • Confirm token exchange uses correct endpoints
  • Validate documentation examples run without errors

@tcaldwell-x tcaldwell-x merged commit 1d87324 into main Dec 2, 2025
4 checks 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.

1 participant