Skip to content

Conversation

@brionmario
Copy link
Member

Purpose

This pull request improves error handling and validation consistency across both the JavaScript SDK and React components for sign-in and sign-up flows. The main changes include aligning error propagation from backend responses, updating API and form error management in React components, and enhancing input validation logic. These updates help ensure that errors are surfaced with clear context and that validation feedback is consistent for end users.

Error Handling Improvements

  • Added an optional failureReason field to both EmbeddedSignInFlowResponse and EmbeddedSignUpFlowResponse interfaces to provide detailed backend error context when a flow fails. Error extraction in React components now prioritizes this field. [1] [2]
  • Updated error propagation in React sign-in and sign-up flows: errors from backend responses are now surfaced using the new failureReason field, and are passed as Error objects to UI components for consistent display. [1] [2] [3] [4]

Form Validation and API Error Management

  • Refactored form error handling in BaseSignIn and BaseSignUp components: renamed errors to fieldErrors for clarity, and introduced a dedicated error prop for API errors. The validateForm function now returns fieldErrors. [1] [2] [3] [4] [5]
  • Updated UI components to display API errors using the new error prop, ensuring users see backend error messages in the interface. [1] [2] [3]

Input Validation Enhancements

  • Improved input validation logic for sign-in: added email format validation for fields of type EMAIL_INPUT, and clarified how touched states are managed for form fields. [1] [2] [3]

API Consistency

  • Changed request payload fields in both sign-in and sign-up flow models from actionId to action for consistency with backend expectations. [1] [2]

Codebase Cleanup

  • Removed unnecessary logging and error wrapping in React sign-in flow, simplifying error handling and reducing console noise. [1] [2] [3] [4] [5]

These changes collectively align error handling between the SDK and UI, improve validation feedback, and make the codebase easier to maintain.

Related Issues

Related PRs

  • N/A

Checklist

  • Followed the CONTRIBUTING guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
  • Unit tests provided. (Add links if there are any)

Security checks

@asgardeo-github-bot
Copy link

🦋 Changeset detected

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

@brionmario brionmario merged commit e702a26 into asgardeo:main Dec 23, 2025
3 of 6 checks passed
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.

3 participants