Skip to content

Comments

feat: add custom token exchange support across all platforms#721

Merged
sanchitmehtagit merged 6 commits intomainfrom
feat/CTE
Jan 21, 2026
Merged

feat: add custom token exchange support across all platforms#721
sanchitmehtagit merged 6 commits intomainfrom
feat/CTE

Conversation

@sanchitmehtagit
Copy link
Contributor

@sanchitmehtagit sanchitmehtagit commented Jan 14, 2026

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

📋 Changes

Description

Implements Custom Token Exchange (RFC 8693) feature for Auth0 Flutter SDK, enabling users to exchange external identity provider tokens for Auth0 credentials.

Dependencies Updated

Auth0 Android: 3.11.0 → 3.12.0 (adds organization parameter to customTokenExchange - Dec 2025)
Auth0.swift: 2.14.0 → 2.16.2 (adds organization parameter to customTokenExchange - Dec 2025)

Core Implementation

  • Android: Added CustomTokenExchangeApiRequestHandler with organization support (requires Auth0 Android SDK 3.12.0+)
  • iOS/macOS: Added AuthAPICustomTokenExchangeMethodHandler with organization support (requires Auth0.swift 2.16.0+)
  • Web: Added JS interop for auth0-spa-js exchangeToken() method with organizationId support
  • Platform Interface: Added AuthCustomTokenExchangeOptions and ExchangeTokenOptions classes with organization parameter

API Methods

// Mobile (Android/iOS)

  auth0.api.customTokenExchange(
    subjectToken: 'external-token',
    subjectTokenType: 'urn:ietf:params:oauth:token-type:jwt',
    audience: 'https://api.example.com',
    scopes: {'openid', 'profile', 'email'},
    organization: 'org_id', // Optional - requires updated native SDKs
    parameters: {'key': 'value'} // Optional
  )

// Web

  auth0Web.customTokenExchange(
    subjectToken: 'external-token',
    subjectTokenType: 'urn:ietf:params:oauth:token-type:jwt',
    organizationId: 'org_id', // Optional
    scopes: {'openid', 'profile', 'email'}
  )

📎 References

🎯 Testing


### Custom Token Exchange

[Custom Token Exchange](https://auth0.com/docs/authenticate/custom-token-exchange) allows you to exchange tokens from external identity providers for Auth0 tokens. This is useful for migrating users from legacy systems or integrating with third-party identity providers.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review examples.md file again

Copy link
Contributor Author

@sanchitmehtagit sanchitmehtagit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging this tested on macos , ios, android and web platform

@sanchitmehtagit sanchitmehtagit merged commit c4345b3 into main Jan 21, 2026
11 of 13 checks passed
@sanchitmehtagit sanchitmehtagit deleted the feat/CTE branch January 21, 2026 12:16
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.

2 participants