Skip to content

Conversation

@developerkunal
Copy link
Contributor

@developerkunal developerkunal commented Oct 29, 2025

🔧 Changes

This PR adds support for OAuth1 connection strategy in the management package, enabling developers to configure and manage OAuth1-based connections (such as Twitter, Tumblr, etc.) through the Auth0 Management API.

Types and Methods Added:

  • ConnectionStrategyOAuth1 constant for identifying OAuth1 connections
  • ConnectionOptionsOAuth1 struct with the following fields:
    • ConsumerKey and ConsumerSecret - OAuth1 client credentials
    • RequestTokenURL - URL for obtaining unauthorized request tokens
    • AccessTokenURL - URL for exchanging request tokens for access tokens
    • UserAuthorizationURL - URL for user authorization
    • SessionKey - Session key for storing request tokens
    • SignatureMethod - Signature method for request signing (default: HMAC-SHA1)
    • CustomHeaders - Custom HTTP headers
    • Scripts - Custom scripts for user profile fetching
  • Auto-generated getter methods for all OAuth1 option fields

Implementation Details:

  • All fields use pointer types with omitempty JSON tags for flexible configuration
  • OAuth1 unmarshal case added to connection type switching
  • No scope support - OAuth1 does not support scopes like OAuth2 does
  • Follows the same pattern as other enterprise connection strategies (SAML, OIDC, etc.)

📚 References

🔬 Testing

Test Coverage:

  • JSON Marshaling Tests: 3 test cases covering basic, extended, and full configuration scenarios
  • JSON Unmarshaling Tests: 3 test cases ensuring proper deserialization
  • CRUD Operation Tests:
    • ✅ Create - HTTP recording included
    • ✅ Read - HTTP recording included
    • ✅ ReadByName - HTTP recording included
    • ⏭️ Update - Intentionally skipped (OAuth1 connections require options at creation time, similar to OIDC, SAML, ADFS, WAAD, and PingFederate)
  • Generated Methods: All getter methods auto-generated and tested

Manual Testing:

Tested against Auth0 tenant with OAuth1 connection creation, retrieval, and deletion. All HTTP interactions recorded for reproducible tests.

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

Add support for OAuth1 connection strategy in the management package.

- Add ConnectionStrategyOAuth1 constant
- Implement ConnectionOptionsOAuth1 structure with OAuth1-specific fields:
  - ConsumerKey and ConsumerSecret for authentication
  - RequestTokenURL, AccessTokenURL, UserAuthorizationURL for OAuth1 flow
  - SessionKey for storing request tokens
  - SignatureMethod for request signing (default: HMAC-SHA1)
  - CustomHeaders for custom HTTP headers
  - Scripts for custom user profile fetching
- Add comprehensive JSON marshaling/unmarshaling tests
- Add OAuth1 to connection CRUD test suite
- Skip Update test for OAuth1 (requires options at creation time)
- Add HTTP test recordings for Create, Read, and ReadByName operations
- Generate getter methods for all OAuth1 option fields

OAuth1 differs from OAuth2 in that it does not support scopes and uses a
two-step token exchange flow with request tokens and access tokens.
@developerkunal developerkunal requested a review from a team as a code owner October 29, 2025 10:35
@developerkunal developerkunal changed the title Add OAuth1 connection strategy support feat: Add OAuth1 connection strategy support in ConnectionManager Oct 29, 2025
@developerkunal developerkunal changed the base branch from main to v1 October 29, 2025 10:37
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.68%. Comparing base (358aa18) to head (f126812).

Additional details and impacted files
@@            Coverage Diff             @@
##               v1     #640      +/-   ##
==========================================
+ Coverage   96.67%   96.68%   +0.01%     
==========================================
  Files          62       62              
  Lines       10614    10654      +40     
==========================================
+ Hits        10261    10301      +40     
  Misses        235      235              
  Partials      118      118              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@developerkunal developerkunal merged commit db872bb into v1 Oct 31, 2025
4 checks passed
@developerkunal developerkunal deleted the feat/oauth1-connection-options branch October 31, 2025 04:48
@developerkunal developerkunal mentioned this pull request Oct 31, 2025
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.

4 participants