Microsoft-authentication-library-for-dotnet: [Bug] Unable to run AcquireTokenInteractive on iOS versions < 13 since version 4.8.1

Created on 10 Feb 2020  路  4Comments  路  Source: AzureAD/microsoft-authentication-library-for-dotnet

Which Version of MSAL are you using ?
MSAL 4.8.1

Platform
Xamarin.Forms (iOS)

What authentication flow has the issue?
Mobile Interactive

Repro
Run 4.8.1 with AcquireTokenInteractive on iOS 10 and it will crash (4.7.1 will work).

Expected behavior
Login view should appear.

Actual behavior
App crashes with the following message:
Foundation.MonoTouchException
Message=Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[WKWebViewConfiguration defaultWebpagePreferences]: unrecognized selector sent to instance 0x1703a1340

Possible Solution
Not solution, but possible cause: 'defaultWebpagePreferences' was introduced in iOS 13 and therefore isn't available on ios 10. You can find reference to 'defaultWebpagePreferences' from this recent commit: https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/commit/b3e43976bd2f0a0d370b3315c5454ce3f4093d8d#diff-c49dff8cf6a7d53678d8a220af373ba1

Fix that and I reckon the problem should be gone.

Fixed bug regression?

Most helpful comment

What I missed mentioning in description above is that this is related to the embedded web view option.

Retro steps:

  • Download the Xamarin.Forms demo project - https://github.com/azure-samples/active-directory-xamarin-native-v2
  • Change the call to AcquireTokenInteractive (line 38 in MainPage.xaml.cs) to include: .WithUseEmbeddedWebView(true)
  • Run project on iOS device with OS version < 13 (10 for example).
  • App crashes with behaviour described above.

All 4 comments

@steffos : Are you saying any interactive request is failing? Can you pls. provide repro steps?

What I missed mentioning in description above is that this is related to the embedded web view option.

Retro steps:

  • Download the Xamarin.Forms demo project - https://github.com/azure-samples/active-directory-xamarin-native-v2
  • Change the call to AcquireTokenInteractive (line 38 in MainPage.xaml.cs) to include: .WithUseEmbeddedWebView(true)
  • Run project on iOS device with OS version < 13 (10 for example).
  • App crashes with behaviour described above.

@steffos Fix is in master now.

@steffos Released in 4.8.2

Was this page helpful?
0 / 5 - 0 ratings