Skip to content

[Bug] Account picker pops up although account + NoPrompt is specified during interactive login #4396

@aries-zhang

Description

@aries-zhang

Library version used

4.56.0

.NET version

.Net Framework 4.8.0

Scenario

PublicClient - desktop app

Is this a new or an existing app?

The app is in production, and I have upgraded to a new version of MSAL

Issue description and reproduction steps

We have an app that can automatically sign the users in with their default Windows account. With MSAL .Net version 4.45.0 which we are currently using, the app is able to sign the users in without any account picker window popped up.

Since we have another issue with 4.45.0 which is it occasionally returns an expired token, we have been trying to upgrade it to the latest versions (4.56.0/4.57.0) for a fix.

However, in 4.56.0/4.57.0, we found that it pops up an account picker when the app attempts to sign in with user's default OS account.

Repro steps:

  1. Download the MSAL demo app from here: https://github.com/gladjohn/NetCoreWinFormsWAM_Maha
  2. Upgrade the MSAL .Net version to 4.56.0 or 4.57.0 (both reproducible)
  3. Run the app
  4. Use the following input, and click "ATI"
  5. Account picker pops up, as shown in the following screenshot

image

Relevant code snippets

PublicClientApplication creation:

PublicClientApplicationBuilder.Create(AppConfiguration.AzureActiveDirectoryClientId)
.WithAuthority(AppConfiguration.AzureActiveDirectoryAuthority)
.WithBroker(new BrokerOptions(BrokerOptions.OperatingSystems.Windows) { ListOperatingSystemAccounts=true })
.WithExperimentalFeatures()
.Build();

ATI:

var account = PublicClientApplication.OperatingSystemAccount;

AcquireTokenInteractiveParameterBuilder tokenBuilder = Client.AcquireTokenInteractive(scopesToRequest)
.WithParentActivityOrWindow(Window.Handle)
.WithAccount(account)
.WithPrompt(Prompt.NoPrompt);

return tokenBuilder.ExecuteAsync();


### Expected behavior

When account and NoPrompt is specified, interactive login should not show the account picker pop up asking users to choose an account.

### Identity provider

Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)

### Regression

4.45.0

### Solution and workarounds

_No response_

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions