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

AADB2C accounts are not removed from the cache in MSAL.Net 2.0.1-internal25504dev #613

Closed
jmprieur opened this issue Sep 13, 2018 · 1 comment
Milestone

Comments

@jmprieur
Copy link
Contributor

Which Version of MSAL are you using ?
MSAL.NET 2.0.1-internal25504dev (Sept 12th, hotfix release candidate)

Which platform has the issue?
All

What authentication flow has the issue?

  • Desktop
    • [x ] Interactive
  • [ x] Mobile

Repro

  1. clone the https://github.com/Azure-Samples/active-directory-b2c-dotnet-desktop repository
  2. checkout
  3. upgrade to MSAL.NET 2.0.1-internal25504dev
  4. build
  5. (if you go again through these steps make sure the cache is deleted from the bin\debug folder)
  6. Run the App
  • sign in with a social identity (for example Google or Microsoft)
  • call the API (if you want)
  • Sign out
  • Sign-in again with a different social identity

Expected behavior
you are signed in with the new identity

Actual behavior
the cache returns an exception
Error Acquiring Token: Microsoft.Identity.Client.MsalServiceException: Returned user identifier does not match the sent user identifier at Microsoft.Identity.Client.Internal.Requests.RequestBase.SaveTokenResponseToCache() at Microsoft.Identity.Client.Internal.Requests.RequestBase.PostTokenRequest() at Microsoft.Identity.Client.Internal.Requests.RequestBase.<RunAsync>d__35.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult() at Microsoft.Identity.Client.PublicClientApplication.<AcquireTokenForUserCommonAsync>d__19.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult() at Microsoft.Identity.Client.PublicClientApplication.<AcquireTokenAsync>d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at active_directory_b2c_wpf.MainWindow.<SignInButton_Click>d__1.MoveNext() in C:\ghs\s\active-directory-b2c-dotnet-desktop\active-directory-b2c-wpf\MainWindow.xaml.cs:line 39 ErrorCode: user_mismatch StatusCode: 0 Claims:

Analysis
If you run it under debugger, you'll notice that there is an exception in CacheFallbackOperations.RemoveAdalUser because the displayableId is null

System.NullReferenceException HResult=0x80004003 Message=Object reference not set to an instance of an object. Source=Microsoft.Identity.Client StackTrace: at Microsoft.Identity.Core.Cache.CacheFallbackOperations.RemoveAdalUser(ILegacyCachePersistance legacyCachePersistance, String displayableId, ISet`1 environmentAliases, String identifier) in C:\gh\adal.net\core\src\Cache\CacheFallbackOperations.cs:line 186
this exception is logged, and does not prevent the cache from being serialized.

@jmprieur
Copy link
Contributor Author

@jennyf19 @trwalke

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

No branches or pull requests

1 participant