question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] pca.GetAccountsAsync() decides to include another account

See original GitHub issue

Which version of MSAL.NET are you using? Microsoft.Identity.Client v4.31.0

Platform .NET 4.6.1 WPF Desktop

What authentication flow has the issue?

  • Desktop / Mobile
    • Silent

Is this a new or existing app? b. The app is in production, I haven’t upgraded MSAL, but started seeing this issue.

Repro https://github.com/RhomGit/MSALDesktopRepro var accounts = await pca.GetAccountsAsync();

Expected behavior Removing all accounts and/or deleting msalcache.bin3 file would remove all accounts. Subsequent logins only would be remembered.

Actual behavior After an unspecified period of time, maybe an hour, GetAccountsAsync() return multiple accounts for some reason, despite the second account never being used by the app.

Additional context / logs / screenshots The account that is being added isn’t my Windows user, nor is it any of my logged in Office365 accounts/Edge browser/Visual Studio accounts. The only app logged in with this account is Teams? The timing seems to coincide with the very recent Windows 10 update.

This occurs in our production app and also occurs in the repro app linked above. I’d say maximum 7 days since I noticed it, probably less and I auth via MSAL every day.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bgavrilMScommented, Jun 14, 2021

@RhomGit - could you email me your app coordinates (client_id, tenant, b2c hostname etc)? bogavril at microsoft com And also could you clarify what accounts are used to login? Are these local accounts or Facebook / Google / other accounts?

0reactions
RhomGitcommented, Jun 14, 2021

And yes, I have my own secure APIs using the scopes you mentioned and Azure EasyAuth.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GetAccountsAsync() does Instance Discovery call...will not ...
A solution is to get Pca.GetAccountsAsync() to return the tokens while offline or have another way to get hold of them. I also...
Read more >
PublicClientApplication - GetAccountsAsync() doesn't ...
I want to use SSO, so the user doesn't have to login to the app seperatly. The app is run on a Azure...
Read more >
Migrate public client applications to MSAL.NET
This article describes how to migrate a public client application from Azure Active Directory Authentication Library for .NET (ADAL.NET) to ...
Read more >
C# (CSharp) IPublicClientApplication. ...
private static async Task OAuthSSO() { string[] scopes = new string[] ... GetAccountsAsync(); AuthenticationResult result = null; if (accounts.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found