Safely aborts an in-progress authentication flow by:
Rejecting the authentication promise with a cancellation error
Shutting down the temporary callback server
Closing the authentication browser window
Cleaning up all related resources and state
Logging the cancellation for debugging purposes
This function can be called at any point during the authentication process,
ensuring all resources are properly cleaned up regardless of the flow state.
It provides a graceful way to handle user-initiated cancellations or
application-driven authentication termination.
No action is taken if there isn't an active authentication flow in progress.
Returns void
Example
// Cancel authentication when user clicks a cancel button cancelButton.addEventListener('click', () => { cancelAuthFlow(); showMessage("Authentication cancelled"); });
Cancels ongoing OAuth authentication flow
Safely aborts an in-progress authentication flow by:
This function can be called at any point during the authentication process, ensuring all resources are properly cleaned up regardless of the flow state. It provides a graceful way to handle user-initiated cancellations or application-driven authentication termination.
No action is taken if there isn't an active authentication flow in progress.