Skip to content

Add setAuthCallbackUrl method for manual authentication handling #836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Toubat
Copy link

@Toubat Toubat commented Apr 26, 2025

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:

  • The method processes callback URLs with proper auth parameters across various URL schemes (https, http, file, chrome-extension, electron)
  • Setting the callback URLs without valid auth parameters are not processed
  • After processing, the auth state is properly reset, preventing duplicate auth processing on rerenders
  • Various URL formats are correctly handled according to Auth0's requirements

All existing tests pass, and code coverage has been maintained at 100%.

Checklist

  • I have added documentation for the new functionality in the JSDoc comments
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used

@Toubat Toubat requested a review from a team as a code owner April 26, 2025 21:14
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.

1 participant