You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add loginWithCustomTokenExchange and deprecate exchangeToken (#1010)
## Changes
This PR aligns with the [auth0-spa-js v2.14.0
release](https://github.com/auth0/auth0-spa-js/releases/tag/v2.14.0) and
introduces the `loginWithCustomTokenExchange` method as the recommended
way to perform custom token exchange.
### What's Changed
- ✨ Add `loginWithCustomTokenExchange()` method to `Auth0Context` and
`Auth0Provider`
- ⚠️ Deprecate `exchangeToken()` method with clear migration guidance
- ⬆️ Update `@auth0/auth0-spa-js` dependency to `^2.14.0`
- ✅ Update tests and mocks to support both methods
- 📝 Update `EXAMPLES.md` with new method usage
### Migration Guide
The `exchangeToken` method is now deprecated. Please migrate to
`loginWithCustomTokenExchange`:
```jsx
// Before (deprecated)
const tokens = await exchangeToken({
subject_token: externalToken,
subject_token_type: 'urn:your-company:legacy-system-token',
});
// After (recommended)
const tokens = await loginWithCustomTokenExchange({
subject_token: externalToken,
subject_token_type: 'urn:your-company:legacy-system-token',
});
```
### Backward Compatibility
The `exchangeToken` method is maintained for backward compatibility and
internally delegates to `loginWithCustomTokenExchange`. It will be
removed in the next major version.
### Testing
- ✅ All tests passing (103 tests)
- ✅ 100% code coverage maintained
- ✅ Both methods tested comprehensively
## References
- Related: auth0/auth0-spa-js#1526
0 commit comments