feat: add support for pre-configured Auth0Client instance in Auth0Pro… #849
+45
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for pre-configured Auth0Client instance in Auth0Provider
Description
This PR introduces a new optional
client
prop to theAuth0Provider
component, allowing developers to pass a pre-configuredAuth0Client
instance instead of having the provider create one internally.Changes
client
prop toAuth0ProviderOptions
interface with comprehensive JSDoc documentationAuth0Provider
component to use the provided client instance when available, falling back to creating a new one if not providedAuth0Client
is instantiatedUse Cases
This enhancement enables several important scenarios:
Example Usage
Backward Compatibility
This change is fully backward compatible. Existing implementations will continue to work unchanged, as the client prop is optional and the provider maintains its existing behavior when not provided.
Testing
Added unit test to verify that when a
client
prop is provided, no newAuth0Client
instance is createdExisting tests continue to pass, ensuring no regression in current functionality
This change adds test coverage for new/changed/fixed functionality
Checklist