Skip to content
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

[Bug] WithAccount(result.Account) doesn't work with WAM #3121

Closed
bgavrilMS opened this issue Jan 24, 2022 · 1 comment · Fixed by #3199
Closed

[Bug] WithAccount(result.Account) doesn't work with WAM #3121

bgavrilMS opened this issue Jan 24, 2022 · 1 comment · Fixed by #3199

Comments

@bgavrilMS
Copy link
Member

bgavrilMS commented Jan 24, 2022

MSAL 4.40

  1. AcquireTokenInteractive with WAM with no login hint -> account picker shows up
  2. AcquireTokenInteractive with WAM for a different scope, using .WithAccount(result.Account);

Actual: account picker shows up displaying ALL accounts
Expected: account should be pre-selected

Root cause: tenant profiles seems to override the WAM account ID:

https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/master/src/client/Microsoft.Identity.Client/AuthenticationResult.cs#L145

Workaround:

Use app.GetAccountsAsync() to get the accounts again and pass in that account.

@bgavrilMS bgavrilMS added this to the 4.41.0 milestone Jan 24, 2022
@bgavrilMS bgavrilMS changed the title [Bug] WAM re-auth is broken on UWP [Bug] WithAccount(result.Account) doesn't work with WAM Jan 25, 2022
@neha-bhargava neha-bhargava self-assigned this Jan 28, 2022
@bgavrilMS
Copy link
Member Author

The account object from the cache has a property named WamAccountId which is needed to link an MSAL account to a WAM account.

This is particularly important when using a 3p app and trying to use MSA accounts, because we can't link MSAL account to WAM account by usename.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants