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] MsalCacheHelper.RegisterCache not working as expected after version upgrade #4681

Closed
PavanKumarCoder opened this issue Mar 26, 2024 · 4 comments

Comments

@PavanKumarCoder
Copy link

Library version used

4.58.1

.NET version

.Net Framework 4.8

Scenario

PublicClient - desktop app

Is this a new or an existing app?

The app is in production, and I have upgraded to a new version of MSAL

Issue description and reproduction steps

IPublicClientApplication.AcquireTokenInteractive is not creating the cache file specified using the MsalCacheHelper.RegisterCache.

This issue started appearing ever since we upgraded the Microsoft.Identity.Client.Extensions.Msal library from 2.31.0 to 4.58.1.
Microsoft.Identity.Client was also upgraded from 4.54.1 to 4.58.1.

Prior the upgrades, the cache file was getting created and everything was fine. However, after upgrade the cache file is not getting created and we are getting continuous login popups.

IPublicClientApplication.AcquireTokenSilent is continuously failing because there is no cache file.

Relevant code snippets

No response

Expected behavior

IPublicClientApplication.AcquireTokenSilent shouldn't fail after initial authentication when we specify the cache file and cache directory.

Identity provider

Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)

Regression

4.54.1

Solution and workarounds

No response

@PavanKumarCoder PavanKumarCoder added needs attention Delete label after triage untriaged Do not delete. Needed for Automation labels Mar 26, 2024
@bgavrilMS
Copy link
Member

I cannot repro this @PavanKumarCoder - I tried on Windows with

var cache = await MsalCacheHelper.CreateAsync(new StorageCreationPropertiesBuilder("cache.bin", MsalCacheHelper.UserRootDirectory).Build())

Where do you put the cache file?

@bgavrilMS bgavrilMS added bug requires more info public-client and removed untriaged Do not delete. Needed for Automation needs attention Delete label after triage labels Mar 26, 2024
@PavanKumarCoder
Copy link
Author

In this directory:

C:\Users**\AppData\Local*\

@localden
Copy link
Collaborator

localden commented Apr 2, 2024

@PavanKumarCoder can you please share your code snippet where you are configuring the cache?

@localden localden self-assigned this May 19, 2024
@localden
Copy link
Collaborator

Closing as there is no input from author. @PavanKumarCoder - feel free to ping us if the issue persists with the latest version of the library.

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

No branches or pull requests

3 participants