feat: Add Custom Token Exchange support#1433
Merged
subhankarmaiti merged 10 commits intomasterfrom Jan 21, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds Custom Token Exchange support using RFC 8693, enabling users to exchange external identity provider tokens for Auth0 tokens. The implementation provides full native (iOS/Android) and web platform support.
Changes:
- Added
customTokenExchange()method toAuth0class anduseAuth0()hook - Implemented
CustomTokenExchangeErrorclass with platform-agnostic error codes for unified error handling - Added complete native bridge support for iOS (Swift) and Android (Kotlin) implementations
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/parameters.ts | Defines CustomTokenExchangeParameters interface with comprehensive documentation |
| src/specs/NativeA0Auth0.ts | Adds native module spec for customTokenExchange method |
| src/platforms/web/adapters/WebAuth0Client.ts | Implements web platform token exchange using auth0-spa-js |
| src/platforms/native/bridge/NativeBridgeManager.ts | Adds native bridge implementation with proper error wrapping |
| src/platforms/native/adapters/NativeAuth0Client.ts | Integrates customTokenExchange with guarded bridge pattern |
| src/core/models/CustomTokenExchangeError.ts | Implements comprehensive error class with multi-platform error code mapping |
| src/hooks/Auth0Provider.tsx | Integrates customTokenExchange into React context and hooks |
| src/hooks/Auth0Context.ts | Adds interface definition for the new method |
| src/Auth0.ts | Exposes customTokenExchange on main Auth0 class |
| src/index.ts | Exports CustomTokenExchangeError and error codes |
| ios/NativeBridge.swift | Implements iOS native token exchange |
| ios/A0Auth0.mm | Adds React Native bridge method for iOS |
| android/src/main/oldarch/com/auth0/react/A0Auth0Spec.kt | Adds Android spec method |
| android/src/main/java/com/auth0/react/A0Auth0Module.kt | Implements Android native token exchange |
| EXAMPLES.md | Provides comprehensive usage examples and error handling guide |
| Test files | Comprehensive test coverage for all implementations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pmathew92
reviewed
Jan 13, 2026
…into feat/custom-token-exchange
…r handling in NativeBridgeManager and WebAuth0Client
…into feat/custom-token-exchange
pmathew92
previously approved these changes
Jan 21, 2026
pmathew92
approved these changes
Jan 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for Custom Token Exchange using RFC 8693, enabling users to exchange external identity provider tokens for Auth0 tokens.
What's New
customTokenExchange()method onAuth0class anduseAuth0()hookUsage
Basic Example