Add setAuthCallbackUrl method for manual authentication handling #836
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.
Description
This PR adds a new method
setAuthCallbackUrl
to the Auth0 context, allowing developers to manually set and process authentication callback URLs without relying on page reloads.The primary benefits include:
Improved Electron support: In Electron and other native desktop applications, handling auth redirects through page reloads can be problematic as they may require special handling in the main process. This method provides a more direct approach.
Enhanced control over auth flow: Developers can now intercept OAuth callback URLs from custom URL schemes / deep links (like
electron-fiddle://
,file://
, etc.) and manually pass them to Auth0 for processing.The implementation ensures that after processing, the auth state is properly reset, preventing duplicate processing while maintaining the security of the authentication flow.
Testing
New test cases have been added to verify:
All existing tests pass, and code coverage has been maintained at 100%.
Checklist