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 Triage in MSAL.NET (legacy) via automation Jan 24, 2022
@bgavrilMS bgavrilMS added this to the 4.41.0 milestone Jan 24, 2022
@bgavrilMS bgavrilMS moved this from Triage to Estimated/Committed in MSAL.NET (legacy) Jan 24, 2022
@bgavrilMS bgavrilMS moved this from Estimated/Committed to Triage in MSAL.NET (legacy) Jan 25, 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
@bgavrilMS bgavrilMS moved this from Triage to Estimated/Committed in MSAL.NET (legacy) Jan 25, 2022
@neha-bhargava neha-bhargava self-assigned this Jan 28, 2022
@neha-bhargava neha-bhargava moved this from Estimated/Committed to In Progress in MSAL.NET (legacy) 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.

@neha-bhargava neha-bhargava moved this from In Progress to Estimated/Committed in MSAL.NET (legacy) Jan 31, 2022
@neha-bhargava neha-bhargava removed their assignment Jan 31, 2022
@gladjohn gladjohn modified the milestones: 4.41.0, 4.42.0 Feb 8, 2022
@gladjohn gladjohn self-assigned this Feb 10, 2022
@neha-bhargava neha-bhargava self-assigned this Feb 22, 2022
@neha-bhargava neha-bhargava moved this from Estimated/Committed to In Progress in MSAL.NET (legacy) Feb 22, 2022
@bgavrilMS bgavrilMS modified the milestones: 4.42.0, 4.43 Feb 28, 2022
@neha-bhargava neha-bhargava linked a pull request Mar 3, 2022 that will close this issue
@bgavrilMS bgavrilMS moved this from In Progress to Blocked/Waiting for reply in MSAL.NET (legacy) Mar 9, 2022
@bgavrilMS bgavrilMS moved this from Blocked/Waiting for reply to In Progress in MSAL.NET (legacy) Mar 16, 2022
MSAL.NET (legacy) automation moved this from In Progress to Fixed Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants