feat(auth0-server-js): export TokenExchangeError from public surface#195
Conversation
Consumers of loginWithCustomTokenExchange() and customTokenExchange() need to catch TokenExchangeError by value (instanceof), but the class lived only in auth0-auth-js which is a transitive dependency. Re-export it so framework SDKs like auth0-fastify can surface it without taking a direct dependency on auth0-auth-js.
📝 WalkthroughWalkthroughA single line is added to ChangesTokenExchangeError Public Export
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… surface Both customTokenExchange() and loginWithCustomTokenExchange() throw MissingClientAuthError when the client is not configured with credentials. Same gap as TokenExchangeError — export it so consumers can catch it by value without reaching into auth0-auth-js directly.
Summary
TokenExchangeErrorandMissingClientAuthErrorfrom@auth0/auth0-auth-jsin theauth0-server-jspublic surfaceloginWithCustomTokenExchange()andcustomTokenExchange()are documented as throwing these errors, but consumers had no way to import them from@auth0/auth0-server-js— they were forced to reach into@auth0/auth0-auth-jsdirectly (a transitive dependency) or fall back to matching onerror.nameTokenExchangeError: thrown when the exchange fails (bad subject token, Auth0 rejects the request, validation errors)MissingClientAuthError: thrown when the client is not configured with aclientSecretorclientAssertionSigningKey— CTE requires a confidential clientauth0-server-js(e.g.auth0-fastify) can now re-export both errors cleanly without addingauth0-auth-jsas a direct dependencyTokenResponseandActClaimadded in feat(auth0-server-js): export TokenResponse and ActClaim types #194