Skip to content

feat(react): create user mfa hook#271

Open
NaveenChand755 wants to merge 8 commits into
feat/mfa-service-hookfrom
feat/mfa-use-mfa-hook
Open

feat(react): create user mfa hook#271
NaveenChand755 wants to merge 8 commits into
feat/mfa-service-hookfrom
feat/mfa-use-mfa-hook

Conversation

@NaveenChand755
Copy link
Copy Markdown
Contributor

@NaveenChand755 NaveenChand755 commented May 7, 2026

Summary

Added useUserMFA — a public hook that owns the full MFA management lifecycle: enrollment phase state, dialog state, and centralised error handling with MFA step-up awareness across fetch, enroll, confirm, and delete.

Why

Existing useMFA/useMFALogic hooks are coupled to component internals — not usable as a public API
Error handling was scattered with no MFA step-up awareness on enroll/confirm paths

What

New useUserMFA hook exposing enrollment phases, dialog state, and all MFA operations
All errors route through one place — step-up/5xx silently to GateKeeper, factor-specific codes toasted with i18n resolver

Packages

  • packages/core
  • packages/react
  • examples

References

Testing

How can this be verified? Note anything intentionally not covered by tests and why.

  • This change adds unit test coverage
  • Tested for both SPA and RWA flows, all example apps working
  • All existing and new tests complete without errors

Checklist

  • Breaking change
  • Requires docs update
  • Backward compatible

Contributing

@NaveenChand755 NaveenChand755 marked this pull request as draft May 7, 2026 13:52
@NaveenChand755 NaveenChand755 added the refactor Restructuring existing code and logic to reduce technical debt and improve quality label May 7, 2026
@NaveenChand755 NaveenChand755 marked this pull request as ready for review May 11, 2026 05:24
Comment thread packages/react/src/hooks/my-account/__tests__/use-user-mfa.test.tsx Outdated
Comment thread packages/react/src/hooks/my-account/__tests__/use-user-mfa.test.tsx Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Restructuring existing code and logic to reduce technical debt and improve quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants