Microsoft-authentication-library-for-dotnet: [Bug] PlatformNotSupportedException in macOS App

Created on 26 Nov 2020  路  8Comments  路  Source: AzureAD/microsoft-authentication-library-for-dotnet

Which Version of MSAL are you using ?
MSAL 4.23.0
MSAL Extensions 2.16.5

Platform
Xamarin.macOS

Is this a new or existing app?
a. The app is in production, and I have upgraded to a new version of MSAL

Repro

var storageProperties = new StorageCreationPropertiesBuilder("msal_cache.dat", Environment.GetFolderPath(Environment.SpecialFolder.Personal), ClientId)
    .WithMacKeyChain(Foundation.NSBundle.MainBundle.BundleIdentifier, "msal_account")
    .Build();
var cacheHelper = await MsalCacheHelper.CreateAsync(storageProperties).ConfigureAwait(false);
cacheHelper.RegisterCache(pca.UserTokenCache);

Expected behavior
After updating MSAL to 4.2.30 I get a PlatformNotSupportedException when trying to add a token cache which is being thrown here: https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/79b57039a076391fe350a736fe9c951322fdd422/src/client/Microsoft.Identity.Client/TokenCache.Notifications.cs#L156-L164

Actual behavior
No exception when adding custom token cache

Additional context/ Logs / Screenshots
Screenshot 2020-11-26 at 08 26 27

Fixed P1 bug regression

Most helpful comment

Ack, please stay on MSAL 4.22 for now. Will get this shipped in 1-2 weeks.

All 8 comments

I have the same issue.

Keeping it open until we ship 4.24

For reference, we're also using this on Xamarin.Mac in order to use the macOS keychain as the token cache.

Without this, iOS uses the keychain, but macOS does not.

Ack, please stay on MSAL 4.22 for now. Will get this shipped in 1-2 weeks.

Now that this issue is resolved, it would be great to add the macOS target to the existing Xamarin.Forms project as well.

@amirvenus : which existing Xamarin.Forms project? do you mean the test app in this repo? or a sample? (AAD? B2C?)

@amirvenus : which existing Xamarin.Forms project? do you mean the test app in this repo? or a sample? (AAD? B2C?)

I meant this repo:
https://github.com/Azure-Samples/active-directory-b2c-xamarin-native

Was this page helpful?
0 / 5 - 0 ratings