Skip to content

Fix/twitterv2 oauth2 pkce#636

Open
Moeed-ul-Hassan wants to merge 2 commits intomarkbates:masterfrom
Moeed-ul-Hassan:fix/twitterv2-oauth2-pkce
Open

Fix/twitterv2 oauth2 pkce#636
Moeed-ul-Hassan wants to merge 2 commits intomarkbates:masterfrom
Moeed-ul-Hassan:fix/twitterv2-oauth2-pkce

Conversation

@Moeed-ul-Hassan
Copy link

Resolves #635
This PR addresses the issue where the twitterv2 provider was failing on X's Free Plan returning a 401 Unauthorized due to its underlying usage of OAuth 1.0a.
Changes made:

  • Removed github.com/mrjones/oauth and migrated the provider entirely to golang.org/x/oauth2
  • Configured Proof Key for Code Exchange (PKCE) by securely generating a CodeVerifier and appending the oauth2.S256ChallengeOption() to ensure compatibility with X's API v2 requirements.
  • Updated the Session struct to use standard OAuth 2.0 fields (AccessToken, RefreshToken, etc.) instead of the legacy OAuth 1.0a tokens.
  • Adjusted and passed all test suites within providers/twitterv2/twitterv2_test.go and session_test.go.
    This makes the twitterv2 provider functionally sound and compatible with modern X developer applications!

Resolves markbates#635 by replacing mrjones/oauth with golang.org/x/oauth2, implementing PKCE required by X's Free tier API, and updating Session/Token structures accordingly.
Resolves markbates#635 by replacing mrjones/oauth with golang.org/x/oauth2, implementing PKCE required by X's Free tier API, and updating Session/Token structures accordingly.
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.

twitterv2 provider uses OAuth 1.0a internally — fails with X Free plan (401 Unauthorized)

1 participant