-
Notifications
You must be signed in to change notification settings - Fork 232
feat: add Multi-Resource Refresh Token (MRRT) support #1258
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
…0Client and WebCredentialsManager
…into SDK-6263_mrrt_support
This reverts commit 20ea213.
…oP key management
…n across platforms
…into feat/dpop-support
…te auth0 dependency to 3.10.0
…ate URL format in NativeBridge
…dance in FAQ and examples
…into feat/dpop-support
…tive-auth0 into SDK-6263_mrrt_support
…into SDK-6263_mrrt_support
… and documentation
…into SDK-6263_mrrt_support
…into SDK-6263_mrrt_support
…into SDK-6263_mrrt_support
…into SDK-6263_mrrt_support
…t-native-auth0 into SDK-6263_mrrt_support
…credentials manager to accept authAPI
…dential management
…mples and prerequisites
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 PR adds comprehensive Multi-Resource Refresh Token (MRRT) support across all platforms (iOS, Android, and Web), enabling applications to obtain access tokens for multiple APIs using a single refresh token.
Key Changes:
- Introduces two new public APIs:
getApiCredentials()andclearApiCredentials() - Adds the
ApiCredentialstype to represent API-specific credentials - Implements MRRT functionality on iOS, Android, and Web platforms with proper error handling and caching
Reviewed changes
Copilot reviewed 32 out of 33 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/types/common.ts |
Adds ApiCredentials type definition with access token, token type, expiration, and scope |
src/types/parameters.ts |
Extends RefreshTokenParameters with optional audience field for MRRT support |
src/types/platform-specific.ts |
Adds web-specific options useMrrt and useRefreshTokensFallback |
src/specs/NativeA0Auth0.ts |
Adds TurboModule specs for getApiCredentials and clearApiCredentials methods |
src/core/models/ApiCredentials.ts |
Implements ApiCredentials class with isExpired() helper method |
src/core/models/CredentialsManagerError.ts |
Adds comprehensive error code mappings for MRRT operations and extensive JSDoc documentation |
src/core/interfaces/ICredentialsManager.ts |
Extends interface with MRRT methods and detailed documentation |
src/core/services/AuthenticationOrchestrator.ts |
Adds audience parameter to refresh token requests |
src/platforms/web/adapters/WebCredentialsManager.ts |
Implements MRRT for web using @auth0/auth0-spa-js |
src/platforms/web/adapters/WebAuth0Client.ts |
Configures web client with useMrrt option and auto-enables refresh tokens |
src/platforms/native/bridge/INativeBridge.ts |
Adds native bridge interface methods for MRRT |
src/platforms/native/bridge/NativeBridgeManager.ts |
Implements native bridge methods for MRRT operations |
src/platforms/native/adapters/NativeCredentialsManager.ts |
Implements MRRT for native platforms with proper error handling |
ios/NativeBridge.swift |
Adds iOS implementation using Auth0.swift SDK's API credentials methods |
ios/A0Auth0.mm |
Exports native methods to React Native bridge |
android/src/main/java/com/auth0/react/A0Auth0Module.kt |
Implements MRRT for Android with proper parameter conversion and threading |
android/src/main/java/com/auth0/react/ApiCredentialsParser.kt |
Parses Android SDK's APICredentials to React Native format |
android/build.gradle |
Upgrades Auth0 Android SDK to v3.11.0 for MRRT support |
src/hooks/Auth0Provider.tsx |
Adds MRRT methods to React context with proper error handling |
src/hooks/Auth0Context.ts |
Exports MRRT methods in context interface with comprehensive JSDoc |
example/src/screens/hooks/CredentialsScreen.tsx |
Adds example UI for testing MRRT functionality |
example/src/screens/class-based/ClassProfile.tsx |
Updates class-based example to demonstrate MRRT usage |
EXAMPLES.md |
Adds comprehensive MRRT documentation with usage examples for hooks and class-based APIs |
FAQ.md |
Adds trailing commas for code consistency |
| Tests | Adds comprehensive test coverage for MRRT operations across all platforms |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adds support for Multi-Resource Refresh Token (MRRT), enabling applications to obtain access tokens for multiple APIs using a single refresh token.
New Public APIs
getApiCredentialsRetrieves access tokens for a specific API audience.
clearApiCredentialsClears cached credentials for a specific audience.
ApiCredentialsTypePlatform Support
Usage
Web Configuration
On the web platform, you must enable MRRT support explicitly in the
Auth0Provider:Prerequisites
offline_accessscope requested during login