AzureAD / microsoft-authentication-library-for-dotnet

Microsoft Authentication Library (MSAL) for .NET
https://aka.ms/msal-net
MIT License
1.36k stars 330 forks source link

AuthenticationContinuationHelper no longer available for Xamarin iOS or Android #4817

Closed Tim-Rasmussen closed 1 week ago

Tim-Rasmussen commented 1 week ago

Library version used

4.61.3

.NET version

.NET Standard 2.1 (Xamarin Forms)

Scenario

PublicClient - mobile 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

Using Visual Studio 2022 to compile our Xamarin Forms app we see the error ''AuthenticationContinuationHelper' does not exist in the current context'.

With the previous version used, 4.60.3, the app compiled successfully.

There are fewer target libraries available for version 4.61.3 which we suspect is the problem. We don't know which target our app uses but it's likely to be one of the missing ones, i.e. monoandroid12.0, net6.0-windows7.0, netstandard2.0, uap10.0.17763 or xamarinios10.

Even though Xamarin is no longer supported, we have to use it because our MAUI version crashes in several places where our Xamarin version doesn't.

We'd like to use the later version because of the security vulnerability in the earlier versions.

Relevant code snippets

// Not really relevant but in Android MainActivity.cs:
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
    base.OnActivityResult(requestCode, resultCode, data);

    // Pass the result to MSAL
    AuthenticationContinuationHelper.SetAuthenticationContinuationEventArgs(requestCode, resultCode, data);
}

Expected behavior

With version 4.60.3 compilation succeeded.

Identity provider

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

Regression

4.60.3

Solution and workarounds

No response

bgavrilMS commented 1 week ago

Hi @Tim-Rasmussen - what target frameworks does your app use? MSAL supports net6-android and net6-ios only, in line with Maui. Xamarin has been deprecated and MSAL has dropped support for it.

Tim-Rasmussen commented 1 week ago

That answers my question, thank you.

Our app uses Xamarin Forms with .NET Standard 2.1 (there doesn’t appear to be an option to use .NET 6). We have converted the app to use MAUI but there are still many issues with it so, like others have mentioned on the Internet, we are having to stick with Xamarin and therefore an earlier version of Microsoft.Identity.Client with the security vulnerability,

bgavrilMS commented 1 week ago

We have released a version which still supports Xamarin and UWP and fixes the CVE - please try https://www.nuget.org/packages/Microsoft.Identity.Client/4.60.4

Tim-Rasmussen commented 1 week ago

That works! For both iOS and Android. Thank you so much.

bgavrilMS commented 1 week ago

Thanks for confirming @Tim-Rasmussen