Improve handling error scenarios in external IDP redirects in V2 #260
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.
This pull request refactors the
SignIncomponent to improve flow state management, error handling, and URL parameter cleanup for authentication flows. The changes introduce several utility functions to centralize logic for handling flow IDs, session data, and OAuth-related parameters, resulting in more robust and maintainable code. Error handling is now more consistent, and the component better cleans up stale or invalid flow state, ensuring a smoother user experience.Flow State Management & Cleanup
setFlowId,clearFlowState,getUrlParams,handleSessionDataKey,resolveFlowId) to centralize and synchronize flow ID and session data between state andsessionStorage. These functions also clean up stale or invalid flow state and related URL parameters, preventing issues with incomplete or expired authentication flows.Error Handling Improvements
setErrorfunction, which sets error state, triggers theonErrorcallback, and ensures errors are displayed in the UI. OAuth errors and flow errors now trigger proper cleanup and user feedback. [1] [2] [3]OAuth & Flow URL Parameter Cleanup
cleanupOAuthUrlParams,cleanupFlowUrlParams) after processing, preventing accidental reuse of expired parameters and improving security. [1] [2]Robust OAuth Callback Handling
Consistent Error Messaging
'SIGN_IN_ERROR'for easier debugging and monitoring. [1] [2]These changes collectively make the authentication flow more reliable, easier to debug, and safer for users.