-
Notifications
You must be signed in to change notification settings - Fork 232
feat: Add Custom Token Exchange support #1433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
…into feat/custom-token-exchange
…r handling in NativeBridgeManager and WebAuth0Client
…into feat/custom-token-exchange
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