-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[msal-v5] Allow for prompt=select_account in native flows #8063
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
base: msal-v5
Are you sure you want to change the base?
Conversation
Co-authored-by: sameerag <[email protected]>
|
@copilot Why are tests not rebased? |
Co-authored-by: sameerag <[email protected]>
Tests are now rebased! I updated both test files to reflect the new behavior where PublicClientApplication.spec.ts: Updated tests to verify native flow is used (commit e3244a1)
PlatformAuthInteractionClient.spec.ts: Replaced error test with success test (commit e3244a1)
The tests now match the original PR #8062 behavior and verify that |
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 rebases changes from PR #8062 to enable prompt=select_account support in native authentication flows on the msal-v5 branch. Previously, this prompt value would cause fallback to web-based authentication; now it works directly with the native broker alongside other supported prompts (none, consent, login).
Key Changes:
- Added
SELECT_ACCOUNTto allowed prompts in native broker validation logic - Updated tests to verify
select_accountuses native flows instead of falling back to web flows - Added beachball change file documenting the enhancement
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/msal-browser/src/controllers/StandardController.ts | Added SELECT_ACCOUNT case to canUsePlatformBroker() prompt validation |
| lib/msal-browser/src/interaction_client/PlatformAuthInteractionClient.ts | Added SELECT_ACCOUNT case to initializeNativeRequest() prompt validation |
| lib/msal-browser/test/interaction_client/PlatformAuthInteractionClient.spec.ts | Replaced test expecting select_account to throw error with test verifying it succeeds |
| lib/msal-browser/test/app/PublicClientApplication.spec.ts | Updated redirect and popup tests to verify native flow is used with select_account prompt |
| change/@azure-msal-browser-prompt-select-account-msal-v5.json | Added beachball change file for tracking this enhancement |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
This PR rebases the changes from PR #8062 "Allow for prompt=select_account in native flows" onto the msal-v5 branch to enable
prompt=select_accountsupport in native authentication flows.Background
Previously, when
prompt=select_accountwas specified in native authentication requests, the flows would fall back to web-based authentication instead of using the native broker. This behavior was inconsistent with other supported prompts likenone,consent, andloginwhich work directly with native flows.Changes Made
This PR makes minimal changes to allow
prompt=select_accountto work with native flows:Core Implementation:
Constants.PromptValue.SELECT_ACCOUNTto the allowed prompts incanUsePlatformBroker()methodConstants.PromptValue.SELECT_ACCOUNTto the prompt validation switch statement ininitializeNativeRequest()Test Updates:
prompt=select_accountdoes NOT fall back to web flow (uses native flow instead)select_accountto throw error with test that expects it to succeedBehavior Change
Before:
After:
Supported Prompts
After this change, native flows support:
prompt=none- Silent authenticationprompt=consent- Force consent promptprompt=login- Force login promptprompt=select_account- Account selection prompt (newly added)prompt=create- Still blocked (throwsnativePromptNotSupportederror)Testing
prompt=select_accountuses native flowscreateCompatibility
This change allows developers to use
prompt=select_accountwith native authentication flows, providing a consistent experience across all supported prompt types while maintaining the native broker's performance benefits.This pull request was created as a result of the following prompt from Copilot chat.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.