Skip to content

feat: add loginWithCustomTokenExchange method#799

Merged
yogeshchoudhary147 merged 1 commit intomainfrom
feat/add-exchange-token-support
Feb 5, 2026
Merged

feat: add loginWithCustomTokenExchange method#799
yogeshchoudhary147 merged 1 commit intomainfrom
feat/add-exchange-token-support

Conversation

@yogeshchoudhary147
Copy link
Contributor

@yogeshchoudhary147 yogeshchoudhary147 commented Feb 2, 2026

📝 Summary

This PR adds support for the loginWithCustomTokenExchange() method from auth0-spa-js 2.14.0 to auth0-angular, enabling token exchange flows based on RFC 8693. This allows apps to exchange external or legacy tokens for Auth0 tokens directly in Angular.

This implementation aligns with the auth0-spa-js changes in auth0/auth0-spa-js#1526.

🔧 Changes

  • Added loginWithCustomTokenExchange() method to the AuthService with full TypeScript and JSDoc support
  • Implemented using RxJS operators with proper error handling
  • Updates the auth state after successful token exchange
  • Exported CustomTokenExchangeOptions and TokenEndpointResponse types
  • Bumped @auth0/auth0-spa-js from 2.13.1 to 2.14.0
  • Added examples and best practices to EXAMPLES.md

🧪 Testing

  • Added 5 new tests for method behavior, error handling, auth state updates, and error propagation
  • All 127 tests passing with full TypeScript coverage
  • Build verified successfully

💥 Impact

  • Enables secure token exchange following RFC 8693
  • Helps migration from legacy auth systems
  • Fully documented, type-safe, and consistent with existing SDK patterns
  • Maintains consistency across Auth0 SPA SDKs

Test plan

  • Unit tests added and passing (127 tests)
  • Build succeeds
  • Documentation added to EXAMPLES.md
  • Types exported correctly
  • Dependency updated to @auth0/auth0-spa-js@2.14.0

@yogeshchoudhary147 yogeshchoudhary147 requested a review from a team as a code owner February 2, 2026 04:48
@yogeshchoudhary147 yogeshchoudhary147 force-pushed the feat/add-exchange-token-support branch from bd8cea9 to 2fd08c3 Compare February 5, 2026 06:22
@yogeshchoudhary147 yogeshchoudhary147 changed the title feat: add custom token exchange support feat: add loginWithCustomTokenExchange method Feb 5, 2026
@yogeshchoudhary147 yogeshchoudhary147 force-pushed the feat/add-exchange-token-support branch 4 times, most recently from 3f853a7 to a68ea25 Compare February 5, 2026 06:39
Adds `loginWithCustomTokenExchange()` method for Custom Token Exchange operations, implementing the spa-js 2.14.0 feature.

Changes:
- Added `loginWithCustomTokenExchange()` method to AuthService
- Exchanges external tokens and establishes authenticated session
- Bumped @auth0/auth0-spa-js from 2.13.1 to 2.14.0
- Added comprehensive tests (5 new tests)
- Updated EXAMPLES.md with new method usage

Implementation follows RFC 8693 token exchange grant type.
@yogeshchoudhary147 yogeshchoudhary147 force-pushed the feat/add-exchange-token-support branch from a68ea25 to a5f1622 Compare February 5, 2026 07:39
@yogeshchoudhary147 yogeshchoudhary147 merged commit 97f19c8 into main Feb 5, 2026
9 checks passed
@yogeshchoudhary147 yogeshchoudhary147 deleted the feat/add-exchange-token-support branch February 5, 2026 12:02
@yogeshchoudhary147 yogeshchoudhary147 mentioned this pull request Feb 5, 2026
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