-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Update NativeAuthSample app to support JIT and MFA #8262
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
Conversation
samples/msal-browser-samples/NativeAuthSample/app/flows/resetPassword/ResetPasswordUIManager.js
Fixed
Show fixed
Hide fixed
samples/msal-browser-samples/NativeAuthSample/app/flows/signin/SignInUIManager.js
Fixed
Show fixed
Hide fixed
…tion or class' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the NativeAuthSample app to support JIT (Just-In-Time) registration and MFA (Multi-Factor Authentication) flows. It removes the custom Utilities.logMessage utility in favor of native console logging, reorganizes the codebase into a cleaner flows/ directory structure, and introduces shared components for managing JIT and MFA authentication flows.
Changes:
- Replaced custom logging utility with native
consolemethods - Reorganized code into
flows/{signin,signup,resetPassword}/structure with dedicated EventCoordinators and UIManagers - Added shared JIT and MFA components with reusable forms and handlers
- Introduced
FormManagerandCodeVerificationManagerfor centralized form management - Updated tests to be more lenient with error message assertions
- Enhanced configuration with MFA support and new helper functions
Reviewed changes
Copilot reviewed 36 out of 37 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/signup.spec.ts | Fixed indentation and updated error assertions to be less strict |
| test/resetpassword.spec.ts | Updated selectors to use shared code verification form and adjusted timeouts |
| package.json | Added Jest flags for better test diagnostics |
| cors.js | Removed verbose logging |
| app/utilities.js | Deleted - replaced with native console |
| app/ui/ui.js | Updated to use console, added debug logging for account updates |
| app/ui/FormManager.js | New - centralized form visibility management |
| app/ui/CodeVerificationManager.js | New - manages shared code verification form across flows |
| Multiple flow files | New coordinator pattern with JIT/MFA delegation |
| app/shared/* | New shared JIT and MFA components |
| app/index.html | Removed duplicate reset password code form, added JIT/MFA forms |
| app/configParser.js | Added MFA claims support |
| app/authConfig.js | Added capabilities configuration |
| app/app.js | Updated imports, improved account initialization |
| .gitignore | Moved native auth config to sample-specific gitignore |
| resetButton(button) { | ||
| if (!button) return; | ||
|
|
||
| button.disabled = false; | ||
| if (button.dataset.originalText) { | ||
| button.textContent = button.dataset.originalText; | ||
| delete button.dataset.originalText; |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The resetButton method signature is inconsistent across UI managers. In SignInUIManager and SignUpUIManager, it takes two parameters (button, originalText), but in ResetPasswordUIManager it only takes one parameter (button). This inconsistency could lead to bugs when calling the method from the event coordinator.
The ResetPasswordEventCoordinator calls this.uiManager.resetButton(resendCodeBtn, originalText) expecting two parameters, but ResetPasswordUIManager.resetButton only accepts one parameter. The second parameter will be silently ignored, which may work but creates an inconsistent API.
| resetButton(button) { | |
| if (!button) return; | |
| button.disabled = false; | |
| if (button.dataset.originalText) { | |
| button.textContent = button.dataset.originalText; | |
| delete button.dataset.originalText; | |
| resetButton(button, originalText) { | |
| if (!button) return; | |
| button.disabled = false; | |
| if (button.dataset.originalText) { | |
| button.textContent = button.dataset.originalText; | |
| delete button.dataset.originalText; | |
| } else if (typeof originalText === "string") { | |
| button.textContent = originalText; |
This pull request primarily refactors the
NativeAuthSampleapp to support JIT and MFA, remove the customUtilities.logMessagelogging utility in favor of nativeconsolelogging, and reorganizes the code for improved modularity and maintainability. Additionally, it updates the.gitignoreto better protect sensitive files and cleans up navigation logic in the UI.