Skip to content

Conversation

@yogeshchoudhary147
Copy link
Contributor

📝 Summary

This PR adds support for the exchangeToken method from auth0-spa-js 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 mirrors the functionality added to auth0-react in auth0/auth0-react#928.

🔧 Changes

  • Added exchangeToken to the AuthService with full TypeScript and JSDoc support
  • Implemented exchangeToken using RxJS operators with proper error handling
  • Updated the auth state after successful exchanges
  • Exported CustomTokenExchangeOptions and TokenEndpointResponse types
  • 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 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

Test plan

  • Unit tests added and passing
  • Build succeeds
  • Documentation added to EXAMPLES.md
  • Types exported correctly

This adds support for the exchangeToken method from auth0-spa-js 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.

Changes:
* Added exchangeToken method to AuthService with full TypeScript and JSDoc support
* Implemented exchangeToken using RxJS operators with proper error handling
* Updated auth state after successful exchanges
* Exported CustomTokenExchangeOptions and TokenEndpointResponse types
* Added comprehensive unit tests for method behavior, error handling, and state updates
* Added examples and best practices to EXAMPLES.md

Impact:
* Enables secure token exchange following RFC 8693
* Helps migration from legacy auth systems
* Fully documented, type-safe, and consistent with existing SDK patterns
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