AzureAD / microsoft-authentication-library-for-dotnet

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

[Bug] MSAL .NET versions < 4.5.0 do not support system browser on iOS 13 #1399

Closed mtanml closed 4 years ago

mtanml commented 4 years ago

Edit to original post

If you are using the system browser with iOS 13, please update to MSAL.NET 4.5.0, which uses the required presentation context when authenticating on system browser with iOS 13.

If you are not using 4.5.0+, you will run into the issue listed below:

Starting with iOS 13, when authenticating using the system browser, MSAL .NET is required to provide a presentation context when using ASWebAuthenticationSession. Apple added multi-window support, and therefore they need to specifically know where to present the context (this is a breaking change).

In iOS 12, the AuthenticationSession API was iOS only and apps drew into a single window. However, now, with iPadiOS and macOS support, MSAL .NET will need to give the session a presentationContextProvider, and that presentationContextProvider will provide a window via the PresentationAnchor method.

Customer impact

Your app is impacted if all of the below are true:

Workaround

Or,

Example:

AuthenticationResult authResult;
authResult = app.AcquireTokenInteractively(scopes)
                .WithUseEmbeddedWebView(true)
                .ExecuteAsync();

Notable Concerns Regarding the Workaround to Use the Embedded Webview

========

Original Post

Which Version of MSAL are you using ? MSAL 4.4.0 (also occurs in 4.3.1)

Platform Xamarin iOS

What authentication flow has the issue?

Other? - please describe;

Is this a new or existing app? The app is in production, and works fine on physical iOS devices (on both iOS 12.x and 13.0). I have upgraded my iPhone emulator to iOS 13, and that is where the issue occurs. Everything still works fine in iOS 12.2 on the emulator.

Repro

                    AuthenticationResult ar = await App.PCA.AcquireTokenInteractive(App.Scopes)
                        .WithAccount(Utils.GetAccountByPolicy(accounts, App.PolicySignUpSignIn))
                        .WithParentActivityOrWindow(App.ParentActivityOrWindow)
                        .ExecuteAsync();

Expected behavior Authentication process initiates

Actual behavior Immediately returns "authentication_canceled"

Possible Solution

Additional context/ Logs / Screenshots

andresbj16 commented 4 years ago

I receive the same error, initially I thought it was for the version of the nuget package but even updating it to version 4.4.0 of MSAL the same error still occurs

zachgreencbt commented 4 years ago

I updated to Xcode 11/iOS 13 last night, and my code is now also returning this error. Was working fine prior to the upgrade.

rulasg commented 4 years ago

We are having the same issue. Since Xcode update to 11 with iOS 13, now code that works on iOS 12 Emulator return authentication_canceled exception. Repro with Microsoft.Identity.client 4.3.1 and 4.4

jmprieur commented 4 years ago

@zachgreencbt @rulasg @andresbj16 @mtanml : does the iOS emulator have the latest version of Microsoft Authenticator?

jmprieur commented 4 years ago

Also adding the Supportability tab as we'd want better error messages if possible than authentication_canceled.

lperezj commented 4 years ago

Mee too. I have the same problem. I update XCode and with the new simulator with IOS 13, not working. I update MSAL from 4.3.x to 4.4.0 and the problem is the same.

jmprieur commented 4 years ago

@lperezj : does the new simulator have the latest Authenticator app?

uarcho commented 4 years ago

Same here, getting the authentication_cancelled error in simulator, still have to test on a phisical device

lperezj commented 4 years ago

@lperezj : does the new simulator have the latest Authenticator app?

I'm testing with IOS 13 simulator. If i test with IOS 12.2 simulator working fine.

jennyf19 commented 4 years ago

@jmprieur i don't believe this is related to the iOS broker, looks like an issue with the iOS 13 simulator, as @lperezj points out. Will investigate.

jmprieur commented 4 years ago

@jennyf19 : and it seems at at least some of the affected apps are B2C apps: @andresbj16, @zachgreencbt @rulasg @lperezj @uarcho are you building b2C apps?

rulasg commented 4 years ago

On our case, same project as @lperezj, we are using a corp app using corporative AAD Tenant.

mtanml commented 4 years ago

My app is B2C

jmprieur commented 4 years ago

Thanks for confirming that both cases are impacted, @rulasg and @mtanml

zachgreencbt commented 4 years ago

If it helps, this sample from Microsoft has the same problem, https://github.com/Azure-Samples/active-directory-xamarin-native-v2

jmprieur commented 4 years ago

yes, @zachgreencbt, I've noticed your issue there: https://github.com/Azure-Samples/active-directory-xamarin-native-v2/issues/84, and other confirmations

mandel-macaque commented 4 years ago

Hello,

Can you please provide the full information of your xamarin.iOS installation, would be good to know if this is happening with a package that support xcode11 or with an older one.

The easiest way to get exact version information:

Then copy/paste the version information (you can use the "Copy Information" button).

The Xcode version information will also be helpful since we have had several releases from Apple. (GM, GM2 or Xcode11 final).

jennyf19 commented 4 years ago

@mtanml @andresbj16 @zachgreencbt @rulasg (see above ^) Thanks @mandel-macaque

mtanml commented 4 years ago

Hello,

Can you please provide the full information of your xamarin.iOS installation, would be good to know if this is happening with a package that support xcode11 or with an older one.

The easiest way to get exact version information:

  • On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.
  • On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.

Then copy/paste the version information (you can use the "Copy Information" button).

The Xcode version information will also be helpful since we have had several releases from Apple. (GM, GM2 or Xcode11 final).

Microsoft Visual Studio Professional 2019 Version 16.3.0 VisualStudio.16.Release/16.3.0+29318.209 Microsoft .NET Framework Version 4.8.03761

Installed Version: Professional

ADL Tools Service Provider 1.0 This package contains services used by Data Lake tools

ASP.NET and Web Tools 2019 16.3.282.33872 ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019 16.3.282.33872 For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 16.3.282.33872 Azure App Service Tools v3.0.0

Azure Data Lake Node 1.0 This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio 2.4.1000.0 Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 16.3.282.33872 Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.4.1000.0 Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.2.0 (d16-2@8b56e20) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents 1.0 Fabric Diagnostic Events

IntelliCode Extension 1.0 IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure HDInsight Azure Node 2.4.1000.0 HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service 2.4.1000.0 Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio 16.0 Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service 2.4.1000.0 Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node 1.0 Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools 2.9 Microsoft Azure Tools for Microsoft Visual Studio 0x10 - v2.9.20816.1

Microsoft Continuous Delivery Tools for Visual Studio 0.4 Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 2.0.83+gbc8a4b23ec Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers 1.1 Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Mono Debugging for Visual Studio 16.3.7 (9d260c5) Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 5.3.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info

Redgate SQL Change Automation 4.0.19255.10541 Extend DevOps processes to your SQL Server databases and safely automate database deployments.

Visit https://www.red-gate.com/sca/productpage for more information.

Copyright (C) 2011 Red Gate Software Ltd. All rights reserved.

This software contains components from Component Owl. SQL Server is a registered trademark of Microsoft Corporation. Visual Studio is a registered trademark of Microsoft Corporation.

SQL Change Automation contains code from the following open source software:

NuGet https://www.nuget.org/ SQL LocalDB Wrapper https://github.com/martincostello/sqllocaldb Autofac https://autofac.org/ Json.NET https://json.net/ MahApps.Metro http://mahapps.com/ SemVer https://github.com/maxhauser/semver Log4Net http://logging.apache.org/log4net/ StringTemplate https://github.com/antlr/stringtemplate4 Extended WPF Toolkit https://wpftoolkit.codeplex.com/ Code InfoBox VSX http://www.codeproject.com/Articles/55196/Code-InfoBox-Visual-Studio-Extension-VSX OctoPack https://github.com/OctopusDeploy/OctoPack SQLite https://sqlite.org/

This product contains icons from http://www.visualpharm.com distributed under a free backlink license.

For license details or other notices relating to the above software, please see NOTICE.TXT and EULA.rtf in the SQL Change Automation application folder.

Redgate SQL Prompt 9.5.15.11225 Write, format, and refactor SQL effortlessly

SQL Server Data Tools 16.0.61908.27190 Microsoft SQL Server Data Tools

SQL Server Reporting Services 15.0.1484.0 Microsoft SQL Server Reporting Services Designers Version 15.0.1484.0

ToolWindowHostedEditor 1.0 Hosting json editor into a tool window

TypeScript Tools 16.0.10821.2002 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.4 for F# 4.6 16.3.0-beta.19455.1+0422ff293bb2cc722fe5021b85ef50378a9af823 Microsoft Visual F# Tools 10.4 for F# 4.6

Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for Containers 1.0 Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes 1.0 Visual Studio Tools for Kubernetes

VisualStudio.Mac 1.0 Mac Extension for Visual Studio

Xamarin 16.3.0.274 (d16-3@06531f8) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.3.0.230 (remotes/origin/d16-3-xcode11@bbe518670) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.3.565 (27e9746) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 10.0.0.43 (d16-3/8af1ca8) Xamarin.Android Reference Assemblies and MSBuild support. Mono: mono/mono/2019-06@7af64d1ebe9 Java.Interop: xamarin/java.interop/d16-3@5836f58 LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94 LibZip: nih-at/libzip/rel-1-5-1@b95cf3f ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.27.1@8212a2d Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

Xamarin.iOS and Xamarin.Mac SDK 13.2.0.42 (5e8a208) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

mandel-macaque commented 4 years ago

@mtanml thanks, that is the correct xamarin.ios for xcode11, we will try to reproduce it in the xamarin-ios side to try and get to the bottom of the issue.

zachgreencbt commented 4 years ago

Hello,

Can you please provide the full information of your xamarin.iOS installation, would be good to know if this is happening with a package that support xcode11 or with an older one.

The easiest way to get exact version information:

  • On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.
  • On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.

Then copy/paste the version information (you can use the "Copy Information" button).

The Xcode version information will also be helpful since we have had several releases from Apple. (GM, GM2 or Xcode11 final).

Microsoft Visual Studio Professional 2019 Version 16.3.0 VisualStudio.16.Release/16.3.0+29318.209 Microsoft .NET Framework Version 4.8.03752

Installed Version: Professional

Visual C++ 2019 00435-20150-13783-AA224 Microsoft Visual C++ 2019

ADL Tools Service Provider 1.0 This package contains services used by Data Lake tools

Application Insights Tools for Visual Studio Package 9.1.00913.1 Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2019 16.3.282.33872 ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019 16.3.282.33872 For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 16.3.282.33872 Azure App Service Tools v3.0.0

Azure Data Lake Node 1.0 This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio 2.3.9000.0 Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 16.3.282.33872 Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.3.9000.0 Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.2.0 (d16-2@8b56e20) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents 1.0 Fabric Diagnostic Events

GitFlow.VS.Extension 1.0 Visual Studio extension that integrates GitFlow

IntelliCode Extension 1.0 IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure HDInsight Azure Node 2.3.9000.0 HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service 2.3.9000.0 Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio 16.0 Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service 2.3.9000.0 Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node 1.0 Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools 2.9 Microsoft Azure Tools for Microsoft Visual Studio 0x10 - v2.9.20816.1

Microsoft Continuous Delivery Tools for Visual Studio 0.4 Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 2.0.83+gbc8a4b23ec Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0 Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers 1.1 Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package 1.0 Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 16.3.7 (9d260c5) Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 5.3.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info

SQL Server Data Tools 16.0.61908.27190 Microsoft SQL Server Data Tools

ToolWindowHostedEditor 1.0 Hosting json editor into a tool window

TypeScript Tools 16.0.10821.2002 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.4 for F# 4.6 16.3.0-beta.19455.1+0422ff293bb2cc722fe5021b85ef50378a9af823 Microsoft Visual F# Tools 10.4 for F# 4.6

Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for Containers 1.0 Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes 1.0 Visual Studio Tools for Kubernetes

VisualStudio.Mac 1.0 Mac Extension for Visual Studio

Windows Template Studio 3.4.19254.1 Windows Template Studio quickly builds a UWP app, using a wizard-based UI to turn your needs into a foundation of Windows 10 patterns and best practices.

Xamarin 16.3.0.274 (d16-3@06531f8) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.3.0.230 (remotes/origin/d16-3-xcode11@bbe518670) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.3.565 (27e9746) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 10.0.0.43 (d16-3/8af1ca8) Xamarin.Android Reference Assemblies and MSBuild support. Mono: mono/mono/2019-06@7af64d1ebe9 Java.Interop: xamarin/java.interop/d16-3@5836f58 LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94 LibZip: nih-at/libzip/rel-1-5-1@b95cf3f ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.27.1@8212a2d Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

Xamarin.iOS and Xamarin.Mac SDK 13.2.0.42 (5e8a208) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

andresbj16 commented 4 years ago

@zachgreencbt @rulasg @andresbj16 @mtanml : does the iOS emulator have the latest version of Microsoft Authenticator?

Yes, I have the latest version of MSAL I have not verified on a physical device to see if the same thing happens as soon as I have this analysis I will share them

andresbj16 commented 4 years ago

@jennyf19 : and it seems at at least some of the affected apps are B2C apps: @andresbj16, @zachgreencbt @rulasg @lperezj @uarcho are you building b2C apps?

My app is initially B2E, the authentication issue is addressed with azure active directory

andresbj16 commented 4 years ago

Hello,

Can you please provide the full information of your xamarin.iOS installation, would be good to know if this is happening with a package that support xcode11 or with an older one.

The easiest way to get exact version information:

  • On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.
  • On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.

Then copy/paste the version information (you can use the "Copy Information" button).

The Xcode version information will also be helpful since we have had several releases from Apple. (GM, GM2 or Xcode11 final).

Visual Studio Enterprise 2019 for Mac Version 8.3 (build 1805) Installation UUID: 0c81f74b-067e-4e52-a203-67ba5242d3de GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 5.16.1.24 (d16-3 / 08809f5b)

Package version: 604000198

Mono Framework MDK Runtime: Mono 6.4.0.198 (2019-06/fe64a4765e6) (64-bit) Package version: 604000198

NuGet Versión: 5.3.0.6192

SDK de .NET Core SDK: /usr/local/share/dotnet/sdk/3.0.100/Sdks Versiones del SDK: 3.0.100 2.1.701 SDK de MSBuild: /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/Current/bin/Sdks

.NET Core Runtime Runtime: /usr/local/share/dotnet/dotnet Versiones de tiempo de ejecución: 3.0.0 2.1.13 2.1.12

Xamarin.Profiler Versión: 1.6.12.26 Ubicación: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater Versión: 11

Apple Developer Tools Xcode 11.0 (14936) Build 11A420a

Xamarin.Mac Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.

Xamarin.iOS Version: 13.2.0.42 (Visual Studio Enterprise) Hash: 5e8a208b Branch: d16-3 Build date: 2019-09-17 14:19:30-0400

Xamarin Designer Version: 16.3.0.230 Hash: bbe518670 Branch: remotes/origin/d16-3-xcode11 Build date: 2019-09-17 18:39:30 UTC

Xamarin.Android Versión: 10.0.0.43 (Visual Studio Enterprise) Confirmación: xamarin-android/d16-3/8af1ca8 Android SDK: /Users/aardila/Library/Developer/Xamarin/android-sdk-macosx Versiones de Android admitidas: 8.0 (nivel de API 26)

Versión de SDK Tools: 26.1.1 Versión de las herramientas de plataforma del SDK: 29.0.2 Versión de las herramientas de compilación del SDK: 28.0.3

Información de compilación: Mono: mono/mono/2019-06@7af64d1ebe9 Java.Interop: xamarin/java.interop/d16-3@5836f58 LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94 LibZip: nih-at/libzip/rel-1-5-1@b95cf3f ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.27.1@8212a2d Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

Microsoft Mobile OpenJDK Java SDK: /Users/aardila/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25 1.8.0-25 El código EPL de Android Designer está disponible EPL: https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager Version: 1.4.0.65 Hash: c33b107 Branch: remotes/origin/d16-3 Build date: 2019-09-19 20:42:44 UTC

Android Device Manager Version: 1.2.0.115 Hash: 724ea69 Branch: remotes/origin/d16-3 Build date: 2019-09-19 20:43:06 UTC

Xamarin Inspector Version: 1.4.3 Hash: db27525 Branch: 1.4-release Build date: Mon, 09 Jul 2018 21:20:18 GMT Client compatibility: 1

Build Information Release ID: 803001805 Git revision: df50511ccb08d4d84a53939f1d7fc0b40cbb0ee1 Build date: 2019-09-20 16:10:55+00 Build branch: release-8.3 Xamarin extensions: da8d448cd65f2cc87c5e6dc7e2c2ca7b96d20c72

Operating System Mac OS X 10.14.6 Darwin 18.7.0 Darwin Kernel Version 18.7.0 Tue Aug 20 16:57:14 PDT 2019 root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64

stephan14x commented 4 years ago

Hi,

I have the same problem, but on the Simulator and on my physical device.

Which Version of MSAL are you using ? MSAL 4.4.0 (also occurs in 4.3.1)

Platform Xamarin iOS

What authentication flow has the issue? Desktop / Mobile [X ] Interactive - against Azure AD Tennant

Is this a new or existing app? App is in development, early stage, but was previously working on iOS 12.4 on device and simulator.

Test devices iOS 13 Simulator - no MS Authenticator App installed iOS 13.1 on iPhone 7 - MS Authenticator App V 6.3.19 installed and multiple accounts added

Possible Solution or Workaround When I add .WithUseEmbeddedWebView(true) to AcquireTokenInteractive both device and simulator are working again. So the problem may have something to do with calling the system browser? Previously there was this popup message requesting permission to use microsoftonline.com to authenticate, which is no longer appearing.

 authResult = await PCA.AcquireTokenInteractive(Scopes)
                                      .WithUseEmbeddedWebView(true) 
                                      .WithAccount(accounts.FirstOrDefault())
                                      .WithPrompt(Prompt.SelectAccount)
                                      .ExecuteAsync();

On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.

Microsoft Visual Studio Community 2019 Version 16.3.1 VisualStudio.16.Release/16.3.1+29324.140 Microsoft .NET Framework Version 4.8.03761

Installed Version: Community

Visual C++ 2019 00435-60000-00000-AA416 Microsoft Visual C++ 2019

ADL Tools Service Provider 1.0 This package contains services used by Data Lake tools

ASP.NET and Web Tools 2019 16.3.283.64955 ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019 16.3.283.64955 For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 16.3.283.64955 Azure App Service Tools v3.0.0

Azure Data Lake Node 1.0 This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio 2.4.1000.0 Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 16.3.283.64955 Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.4.1000.0 Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.2.0 (d16-2@8b56e20) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents 1.0 Fabric Diagnostic Events

IntelliCode Extension 1.0 IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure HDInsight Azure Node 2.4.1000.0 HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service 2.4.1000.0 Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio 16.0 Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service 2.4.1000.0 Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node 1.0 Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools 2.9 Microsoft Azure Tools for Microsoft Visual Studio 0x10 - v2.9.20816.1

Microsoft Continuous Delivery Tools for Visual Studio 0.4 Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 2.0.83+gbc8a4b23ec Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0 Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers 1.1 Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package 1.0 Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 16.3.7 (9d260c5) Support for debugging Mono processes with Visual Studio.

Node.js Tools 1.5.10807.1 Commit Hash:4d3cf548113f5a53a02d83a877ee24e764b2cde4 Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager 5.3.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Office Developer Tools for Visual Studio 16.0.29217.00 Microsoft Office Developer Tools for Visual Studio

ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info

SQL Server Data Tools 16.0.61908.27190 Microsoft SQL Server Data Tools

ToolWindowHostedEditor 1.0 Hosting json editor into a tool window

TypeScript Tools 16.0.10821.2002 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.4 for F# 4.6 16.3.0-beta.19455.1+0422ff293bb2cc722fe5021b85ef50378a9af823 Microsoft Visual F# Tools 10.4 for F# 4.6

Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for Containers 1.0 Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes 1.0 Visual Studio Tools for Kubernetes

Visual Studio Tools for Unity 4.3.3.0 Visual Studio Tools for Unity

VisualStudio.Mac 1.0 Mac Extension for Visual Studio

Web Accessibility Checker 1.5.58 The easiest way to perform accessibility checks on any ASP.NET web application. Fully customizable and support all the major international accessibility standards.

Workflow Manager Tools 1.0 1.0 This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin 16.3.0.274 (d16-3@06531f8) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.3.0.230 (remotes/origin/d16-3-xcode11@bbe518670) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.3.565 (27e9746) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 10.0.0.43 (d16-3/8af1ca8) Xamarin.Android Reference Assemblies and MSBuild support. Mono: mono/mono/2019-06@7af64d1ebe9 Java.Interop: xamarin/java.interop/d16-3@5836f58 LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94 LibZip: nih-at/libzip/rel-1-5-1@b95cf3f ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.27.1@8212a2d Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

Xamarin.iOS and Xamarin.Mac SDK 13.2.0.42 (5e8a208) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.

=== Visual Studio Community 2019 for Mac ===

Version 8.3 (build 1805) Installation UUID: a5347a83-fd65-48f3-ac10-99c82e59b239 GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 5.16.1.24 (d16-3 / 08809f5b)

Package version: 604000198

=== Mono Framework MDK ===

Runtime: Mono 6.4.0.198 (2019-06/fe64a4765e6) (64-bit) Package version: 604000198

=== NuGet ===

Version: 5.3.0.6192

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.0.100/Sdks SDK-Versionen: 3.0.100 2.1.701 2.1.505 MSBuild-SDKs: /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core-Runtime ===

Laufzeit: /usr/local/share/dotnet/dotnet Laufzeitversionen: 3.0.0 2.1.13 2.1.12 2.1.9

=== Xamarin.Profiler ===

Version: 1.6.11.16 Speicherort: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Xamarin.Android ===

Version: 10.0.0.43 (Visual Studio Community) Commit:xamarin-android/d16-3/8af1ca8 Android SDK: /Users/stephan/Library/Developer/Xamarin/android-sdk-macosx Unterstützte Android-Versionen: 8.1 (API-Ebene 27)

Version von SDK Tools: 26.1.1 Version der SDK-Plattformtools: 28.0.0 Version der SDK-Buildtools: 27.0.3

Buildinformationen: Mono: mono/mono/2019-06@7af64d1ebe9 Java.Interop: xamarin/java.interop/d16-3@5836f58 LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94 LibZip: nih-at/libzip/rel-1-5-1@b95cf3f ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.27.1@8212a2d Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/stephan/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25 1.8.0-25 Android Designer EPL-Code ist hier verfügbar: https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 1.4.0.65 Hash: c33b107 Branch: remotes/origin/d16-3 Build date: 2019-09-19 20:42:44 UTC

=== Android Device Manager ===

Version: 1.2.0.115 Hash: 724ea69 Branch: remotes/origin/d16-3 Build date: 2019-09-19 20:43:06 UTC

=== Apple Developer Tools ===

Xcode 11.0 (14936) Build 11A420a

=== Xamarin.Mac ===

Version: 6.2.0.42 (Visual Studio Community) Hash: 5e8a208b Branch: d16-3 Build date: 2019-09-17 14:19:30-0400

=== Xamarin.iOS ===

Version: 13.2.0.42 (Visual Studio Community) Hash: 5e8a208b Branch: d16-3 Build date: 2019-09-17 14:19:30-0400

=== Xamarin Designer ===

Version: 16.3.0.230 Hash: bbe518670 Branch: remotes/origin/d16-3-xcode11 Build date: 2019-09-17 18:39:30 UTC

=== Xamarin Inspector ===

Version: 1.4.3 Hash: db27525 Branch: 1.4-release Build date: Mon, 09 Jul 2018 21:20:18 GMT Client compatibility: 1

=== Build Information ===

Release ID: 803001805 Git revision: df50511ccb08d4d84a53939f1d7fc0b40cbb0ee1 Build date: 2019-09-20 16:10:55+00 Build branch: release-8.3 Xamarin extensions: da8d448cd65f2cc87c5e6dc7e2c2ca7b96d20c72

=== Operating System ===

Mac OS X 10.14.6 Darwin 18.7.0 Darwin Kernel Version 18.7.0 Tue Aug 20 16:57:14 PDT 2019 root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64

Additional context/ Logs / Screenshots

I have not tried to remove the Authenticator App as suggested here: https://github.com/AzureAD/microsoft-authentication-library-for-objc/issues/698

If you need additional information please advise how to obtain them.

jennyf19 commented 4 years ago

@stephan14x can you provide logs for the device + authenticator case?

stephan14x commented 4 years ago

@jennyf19 how do I create the logs you need? preferable from Visual Studio on Windows (Device connected with USB to Mac) any help appreciated

jennyf19 commented 4 years ago

@stephan14x if you can set this up, it should do the trick. you can send via email if you prefer. jeferrie@microsoft.com thank you.

stephan14x commented 4 years ago

@jennyf19 email is on its way

lperezj commented 4 years ago

Hello,

Can you please provide the full information of your xamarin.iOS installation, would be good to know if this is happening with a package that support xcode11 or with an older one.

The easiest way to get exact version information:

  • On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.
  • On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.

Then copy/paste the version information (you can use the "Copy Information" button).

The Xcode version information will also be helpful since we have had several releases from Apple. (GM, GM2 or Xcode11 final).

=== Visual Studio Enterprise 2019 for Mac ===

Version 8.3 (build 1805) Installation UUID: a583c35f-fc20-46ad-9d83-2da94989a4d7 GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 5.16.1.24 (d16-3 / 08809f5b)

Package version: 604000198

=== Mono Framework MDK ===

Runtime: Mono 6.4.0.198 (2019-06/fe64a4765e6) (64-bit) Package version: 604000198

=== NuGet ===

Version: 5.3.0.6192

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.0.100/Sdks SDK Versions: 3.0.100 2.1.701 2.1.700 2.1.505 2.1.504 2.1.503 2.1.302 2.1.4 MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 3.0.0 2.1.12 2.1.11 2.1.9 2.1.8 2.1.7 2.1.2 2.0.5

=== Xamarin.Profiler ===

Version: 1.6.11.16 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Xamarin.Android ===

Version: 10.0.0.43 (Visual Studio Enterprise) Commit: xamarin-android/d16-3/8af1ca8 Android SDK: /Users/758792/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 8.0 (API level 26) 8.1 (API level 27)

SDK Tools Version: 26.1.1 SDK Platform Tools Version: 29.0.1 SDK Build Tools Version: 28.0.3

Build Information: Mono: mono/mono/2019-06@7af64d1ebe9 Java.Interop: xamarin/java.interop/d16-3@5836f58 LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94 LibZip: nih-at/libzip/rel-1-5-1@b95cf3f ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.27.1@8212a2d Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/758792/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_8.0.25 1.8.0-25 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 1.4.0.65 Hash: c33b107 Branch: remotes/origin/d16-3 Build date: 2019-09-19 20:42:44 UTC

=== Android Device Manager ===

Version: 1.2.0.115 Hash: 724ea69 Branch: remotes/origin/d16-3 Build date: 2019-09-19 20:43:06 UTC

=== Xamarin Inspector ===

Version: 1.4.3 Hash: db27525 Branch: 1.4-release Build date: Mon, 09 Jul 2018 21:20:18 GMT Client compatibility: 1

=== Apple Developer Tools ===

Xcode 11.0 (14936) Build 11A420a

=== Xamarin.Mac ===

Version: 6.2.0.42 (Visual Studio Enterprise) Hash: 5e8a208b Branch: d16-3 Build date: 2019-09-17 14:19:30-0400

=== Xamarin.iOS ===

Version: 13.2.0.42 (Visual Studio Enterprise) Hash: 5e8a208b Branch: d16-3 Build date: 2019-09-17 14:19:30-0400

=== Xamarin Designer ===

Version: 16.3.0.230 Hash: bbe518670 Branch: remotes/origin/d16-3-xcode11 Build date: 2019-09-17 18:39:30 UTC

=== Build Information ===

Release ID: 803001805 Git revision: df50511ccb08d4d84a53939f1d7fc0b40cbb0ee1 Build date: 2019-09-20 16:10:55+00 Build branch: release-8.3 Xamarin extensions: da8d448cd65f2cc87c5e6dc7e2c2ca7b96d20c72

=== Operating System ===

Mac OS X 10.14.6 Darwin 18.7.0 Darwin Kernel Version 18.7.0 Tue Aug 20 16:57:14 PDT 2019 root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64

GaryGormley commented 4 years ago

Same issue here with both iOS 13 simulator and iPhone 6s plus device running iOS 13.1. Using B2C app, MSAL v4.40 But the Suggested workaround given by stephan14x worked.

uarcho commented 4 years ago

I can also confirm the workaround by stephan14x:

.WithUseEmbeddedWebView(true)

solve the issue even if the behaviour is different (no popup warning the user about a login through microsoftonline)

rulasg commented 4 years ago

Adding .WithUseEmbeddedWebView(true) on the AcquireTokenInteractive call works. Now our code, @lperezj too, code is working on iOS 13 Emulator. :)

ChristopherSt-Pierre commented 4 years ago

I confirm that the solution given by stephan14x works, but we cannot use Google authentication with Azure B2C. :P

andresbj16 commented 4 years ago

Great! The solution works correctly thanks

mtanml commented 4 years ago

Thank you stephan14x the solution works great, and losing that popup warning about logging in with Microsoft is a nice bonus :)

bgavrilMS commented 4 years ago

Please note that using an Embedded Web View instead of the System Browser leads to a poorer experience in terms of SSO - i.e. the system browser will remember the account used to sign in across different applications and end-users do not need to retype their password. The embedded browser does not do this as far as I remember.

Also, note @ChristopherSt-Pierre's observation - B2C configured with Google provider is prevented from working from the embedded browser.

Because of these reasons, we have consciously chosen to make the system browser the default option in MSAL.

I'd recommend logging in a few time with the embedded browser and seeing if the experience is good enough. Consider keeping the system browser on Android until we have a solution for this.

mtanml commented 4 years ago

I was able to login with Google (as a B2C provider) without any apparent issues

zachgreencbt commented 4 years ago

Please note that using an Embedded Web View instead of the System Browser leads to a poorer experience in terms of SSO - i.e. the system browser will remember the account used to sign in across different applications and end-users do not need to retype their password. The embedded browser does not do this as far as I remember.

Also, note @ChristopherSt-Pierre's observation - B2C configured with Google provider is prevented from working from the embedded browser.

Because of these reasons, we have consciously chosen to make the system browser the default option in MSAL.

I'd recommend logging in a few time with the embedded browser and seeing if the experience is good enough. Consider keeping the system browser on Android until we have a solution for this.

I can confirm that via Embedded Web View, I do have to retype password each time. This isn't ideal, but it will work as a stop gap until a resolution is found. Thanks.

bgavrilMS commented 4 years ago

@jennyf19 - can you comment on issues with B2C with Google provider? I remember there was smth done to prevent embedded weview.

ChristopherSt-Pierre commented 4 years ago

@bgavrilMS For Google provider.

The error I got is : 403, Error: disallowed_useragent "Google can't sign you in safely inside this app. You can use Google sign-in by visiting this app's website in a browser like Safari or Chrome".

From Google : "In the coming months, we will no longer allow OAuth requests to Google in embedded browsers knows as 'web-views'"

jennyf19 commented 4 years ago

@bgavrilMS @ChristopherSt-Pierre I documented this in our wiki...embedded webview will not work for google w/b2clogin.com. only if using login.microsoftonline.com...b2clogin.com is not on their allow list.

sdebruyn commented 4 years ago

I also have this issue on physical iOS 13 devices, not just simulators

jennyf19 commented 4 years ago

@SamuelDebruyn Thanks for adding on here. We need to implement a presentation context w/iOS 13 when using system browser. We are in the process of making the changes necessary in MSAL.NET. This thread will be updated accordingly.

krudraiah commented 4 years ago

the work around suggested does not work for intune managed devices. We get the prompt to login but fails on "Device Needs to be managed" policy. I am assuming it is because UseWithEmbeddedWebView does not share the same cookie information used by Company Portal.

jennyf19 commented 4 years ago

Thanks for the additional info @krudraiah

RhomGit commented 4 years ago

Sigh, I am happy to see an already existing workaround for this library, thanks @stephan14x Releasing our latest build to the App store has been a nightmare thanks to iOS13 breaking so many libraries.

Special thanks also to @jennyf19 and @jmprieur for all your work on MSAL (including the documentation) over the last couple of years. You've done a great job.

jennyf19 commented 4 years ago

Special thanks also to @jennyf19 and @jmprieur for all your work on MSAL (including the documentation) over the last couple of years. You've done a great job.

@RhomGit ... @jmprieur, myself, and our entire team appreciate the feedback! Thank you.

jennyf19 commented 4 years ago

@mtanml @andresbj16 @zachgreencbt @rulasg @RhomGit @krudraiah @SamuelDebruyn @ChristopherSt-Pierre @uarcho

FYI - we have updated our wiki and determined the root cause. Thanks @stephan14x for figuring out the workaround so quickly.

Will update here as needed.

cc: @jmprieur @bgavrilMS @henrik-me

mehamm commented 4 years ago

First, thanks to jennyf19 and jmprieur for working on this issue.

Could you please provide an estimated time frame for resolving this issue?

Thank you.