-
Notifications
You must be signed in to change notification settings - Fork 145
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
Unable To Clear Accounts: "Multiple accounts found in cache." #923
Comments
@AnthonyUccello Can you please specify whether you are trying to build a single account application or a multiple account application. Because the api getCurrentAccount is only intended for single account application. The crash you mentioned shouldn't happen if the accounts array is non-empty. Can you please paste the crash log as well. |
I might not have the terminology right but I think the goal was a single but users could change. If single means one and only one user ever as the login per app instance then I would say ours was multiple in this case. My solution to logout was to do an interactiveLogin() and do a logout call as soon as the login completed with the account. Using the accounts() would always crash. There is no log for this just the EXE Breakpoint and the Protocol non-compliance messages I showed in the screens. To reproduce this issue I believe you can do it with the following: |
@AnthonyUccello Could you please reproduce the issue and send us the logs? such that we could take a closer look. Regarding whether we should return nil accounts when there is none in the cache, we created a bug here for tracking: #929 |
@jasoncoolmax Sorry I am no longer working on the project that was using this sdk. However the steps I outlined should reproduce the issue. |
Closing since we cannot reproduce this. |
I also get the exact issue as @AnthonyUccello , witth the same steps mentioned above. //Pasting the same steps reported by AnthonyUccello Error I get |
@AnthonyUccello Were you able to solve this? |
I am seeing the same issue. I can't give repro steps since I don't know exactly what I did, and I don't know how to un-do things so I can figure out the steps to repro. Error Domain=MSALErrorDomain Code=-50000 "(null)" UserInfo={MSALErrorDescriptionKey=Multiple accounts found in cache., MSALInternalErrorCodeKey=-42102} How can I clear things out? I tried removing the account in MS Authenticator (and device unregister) and deleted that app (and my app) as well. |
Reopening the issue. |
This issue has been automatically marked as stale because it has not had recent activity. Please provide additional information if requested. Thank you for your contributions. |
Hi @sudeepngeorge & @locksleyu, thank you for helping to highlight the issue. MSALPublicClientApplication actually has a public API that allows you to query multiple accounts, and I believe @AnthonyUccello did not use the correct API to do so. Let me provide you a sample code to do so in Obj-C, assuming that you already have multiple accounts in the cache.
===================
|
I also have this issue. I can't see how getCurrentAccount is ever viable to use, since as soon as multiple users login, this method will always throw an exception? To be clear, I want to use single account mode (only ever one user logged in). |
I also encounter the same issue? What is the fixed for multiple account found issue |
Removing all accounts from the cache works for me, see https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-java-get-remove-accounts-token-cache |
here is help on this we Single Account mode and Multiple account mode. https://azuread.github.io/microsoft-authentication-library-for-objc/ |
Hello
I have an app where 2 users logged in (on subsequent app launches). Now when I invoke
application.getCurrentAccount
I get the error:Couldn't query current account with error: Err domain:MSALErrorDomain code:-50000 userInfo:{ MSALErrorDescriptionKey = "Multiple accounts found in cache."; MSALInternalErrorCodeKey = "-42102"; }
I figured the issue then was to clear the cache however there is no api on the cache config. My next idea was to get all accounts and sign out the users one by one. However, when I get the accounts object, it crashes when I try to inspect the array or access it in any fashion.
I tried to iterate the accounts but it says it fails to conform
Even just printing the returned object fails:
Can you advise what else I can do to either log out the accounts or clear the cache? I am unable to getCurrentAccount anymore so login always has to be done manually. (Also note I have cleared my safari cache and that didnt work either)
The text was updated successfully, but these errors were encountered: