Closed leskodan closed 3 years ago
@leskodan you might want to borrow the following implementation of this token cache: https://github.com/Azure-Samples/active-directory-dotnet-desktop-msgraph-v2/blob/msal3x/active-directory-wpf-msgraph-v2/TokenCacheHelper.cs, which, I believe I've modified for this issue
@Shama-K : do you mind please updating the token cache helper of this sample with that cache (of the AAD sample)?
Appreciate it @jmprieur! I'll check it out and let you know if I have issues.
@jmprieur This block definitely clarifies for me what is going on here. That said, Windows
is not defined here. What package does this depend on?
@leskodan, I think Microsoft.Windows.SDK.Contracts. See https://github.com/Azure-Samples/active-directory-dotnet-desktop-msgraph-v2/blob/da9b6673b0cefef430f5228ba985490441e0a8e6/active-directory-wpf-msgraph-v2/active-directory-wpf-msgraph-v2.csproj#L109-L111
@jmprieur appreciate the help. Unfortunately I'm still having issues though. Having installed the Microsoft.Windows.SDK.Contracts package, I am still getting errors telling me that Windows
does not exist in the Microsoft namespace. This is true for .NET framework 4.7.2 which I am using right now and 4.6.1 which I briefly retargeted to to match the sample you provided. Any thoughts on why this is happening? All I need to do here is access the token cache.
@leskodan : I would suggest you look at the csproj of the WPF one. cc; @bgavrilMS @trwalke @pmaytak to help
@jmprieur @bgavrilMS @trwalke @pmaytak I am trying to modify this active-directory-b2c-dotnet-desktop sample to work once packaged and distributed. Therefore, the csproj file does not have any reference to the token cache issue.
CacheFilePath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalCacheFolder.Path, ".msalcache.bin3");
Using the application data location for packaged msix apps is not working for me either as I cannot get any of the Windows apis to work in this sample, even with Microsoft.Windows.SDK.Contracts
installed. I get the "Windows does not exist in the namespace Microsoft" error.
Any ideas for a workaround or alternative approach?
Got it! I was missing the step of converting my default package management to package reference. Thanks for everyone's help!
Try and run the application as an administrator. Then the access to the folder should no longer be denied.
Hi there! This is a great sample that was straight forward to connect to my own B2C tenant and get working quickly.
As I start to experiment with it however, I am running into some issues. I would like to be able to package and distribute an application protected against B2C as a .msix. Having done so, I am running into an issue where an installed copy of the sample is not permitted access to the token cache.