[msal-v5] Allow for prompt=select_account in native flows #8063
+112
−36
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 PR rebases the changes from PR #8062 "Allow for prompt=select_account in native flows" onto the msal-v5 branch to enable
prompt=select_account
support in native authentication flows.Background
Previously, when
prompt=select_account
was 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
, andlogin
which work directly with native flows.Changes Made
This PR makes minimal changes to allow
prompt=select_account
to work with native flows:Core Implementation:
Constants.PromptValue.SELECT_ACCOUNT
to the allowed prompts incanUsePlatformBroker()
methodConstants.PromptValue.SELECT_ACCOUNT
to the prompt validation switch statement ininitializeNativeRequest()
Test Updates:
prompt=select_account
does NOT fall back to web flow (uses native flow instead)select_account
to 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 (throwsnativePromptNotSupported
error)Testing
prompt=select_account
uses native flowscreate
Compatibility
This change allows developers to use
prompt=select_account
with 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.