MAUI Secure Storage not working in .NET 8

198 Views Asked by At

I have updated my MAUI app to .NET 8 and since then my LocalStorage has started to fail. I have noticed that the storage no longer maintains session information correctly, as after a short period of time of minimizing the app, it prompts for login again.

In a component of my code, I have this condition to check that user data is not null (a condition that should only be met if the session was closed voluntarily):

if (await storage.GetItem<UserInfo>(LocalStorageKey.UserInfo) == null)

Has anyone experienced similar issues or knows what the possible solution might be?

1

There are 1 best solutions below

0
Jianwei Sun - MSFT On

I have updated my MAUI app to .NET 8 and since then my LocalStorage has started to fail. I have noticed that the storage no longer maintains session information correctly, as after a short period of time of minimizing the app, it prompts for login again....

Yes, there are indeed some problems with using SecureStorage, when app is upgraded to .NET 8. And yes, currently .NET 8 has many issues.

You can see some related issues on Maui GitHub, e.g. this: SecureStorage GetAsync not working in .NET 8 MAUI #17706. Regarding the problem you encountered, you can also report it on MAUI GitHub issue.