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

Accounts count sets to 0 in MSAL, after the application auto update. (Windows) #22928

Open
VaibhavMethuku01 opened this issue Jun 8, 2024 · 1 comment
Labels
area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions platform/windows 🪟 t/bug Something isn't working

Comments

@VaibhavMethuku01
Copy link

Description

Hello,

I hope this message finds you well. I am reaching out to report an issue I am encountering with MSAL authentication in my MAUI application, specifically related to the automatic update process using the embedded appinstaller.

Here is the scenario:

  1. Currently, I have version 1.0.0 of my MAUI application installed on my machine.
  2. Whenever an update is available on the server, the application automatically downloads and updates to the latest version.
  3. Let's say version 2.0.0 is available on the server, and my application updates successfully to this version.
  4. After the update to version 2.0.0, I can see the previously authenticated accounts within the application.
  5. However, upon closing and reopening the application after the update, the previously authenticated accounts are no longer visible.
  6. This behavior is unexpected and disrupts the user experience, as users are required to log in again after each application update, even though they were previously authenticated.

I have followed the approach outlined in the Microsoft documentation on how to embed an appinstaller file for automatic updates, but it seems that the authentication state is not being preserved during the update process. [https://learn.microsoft.com/en-us/windows/msix/app-installer/how-to-embed-an-appinstaller-file]

Could you please assist me in resolving this issue? I would appreciate any guidance or suggestions on how to ensure that the MSAL authentication state is maintained across application updates.

Thank you for your attention to this matter. I look forward to your prompt response and assistance in resolving this issue.

FYI
image

I'm using this way for caching for windows.

`if(Device.RuntimePlatform == Device.UWP)
{
mPublicClientApplication = PublicClientApplicationBuilder.Create(options.ClientId)
.WithAuthority(options.Authority)
.WithRedirectUri(SpecialRedirectUri ?? $"msal{options.ClientId}://auth")
.WithWindowsEmbeddedBrowserSupport()

                                                .Build();
AttachTokenCache(mPublicClientApplication.UserTokenCache);

}`

`private async Task AttachTokenCache(ITokenCache tokenCache)
{
string CacheFilePath = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\abccache\msalcache.bin";
StorageCreationProperties storageProperties = new StorageCreationPropertiesBuilder("abccache", CacheFilePath).Build();

	MsalCacheHelper msalcachehelper = await MsalCacheHelper.CreateAsync(storageProperties);
	msalcachehelper.RegisterCache(tokenCache);

`}``

Thanks,
Vaibhav Methuku.

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

Unknown/Other

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.0-preview.1.7762

Affected platforms

Windows

Affected platform versions

windows

Did you find any workaround?

No

Relevant log output

No response

@VaibhavMethuku01 VaibhavMethuku01 added the t/bug Something isn't working label Jun 8, 2024
Copy link
Contributor

github-actions bot commented Jun 8, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@PureWeen PureWeen added the area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions platform/windows 🪟 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants