microsoft-authentication-library-for-dotnet
                                
                                 microsoft-authentication-library-for-dotnet copied to clipboard
                                
                                    microsoft-authentication-library-for-dotnet copied to clipboard
                            
                            
                            
                        [Bug] Xamarin Forms android broker authentication not working with authenticator
Library version used
4.56.0
.NET version
Xamarin Forms android project
Scenario
PublicClient - mobile app
Is this a new or an existing app?
None
Issue description and reproduction steps
As stated in Enable cross-app SSO on Android using MSAL, if an Android device has the Authenticator or Intune Company Portal app installed, the authentication process should go through Authenticator. However, I've observed an issue where, after logging in, the app attempts to launch Authenticator, but the Authenticator briefly appears and then disappears, continuously flickering without allowing the user to return to the app. The only solution seems to be forcibly closing the app.
For the same code in my project, iOS is working.
This happen in android >= version 10,
How to replicate:
- Download the sample project active-directory-xamarin-native-v2
- Change the ClientID, msal key and etc to your own
- Change the scope from
public static string[] Scopes = { "User.Read" };
to
private static readonly string[] Scopes = { "openid" };
- Add WithTenantId() as below
var builder = PublicClientApplicationBuilder
                    .Create(App.ClientID)
                    .WithTenantId("XXX");
- Start the project and try login
https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/assets/90165282/361b3b04-ecb3-4629-bcd2-82bff883d8ea
Relevant code snippets
You can get the project here
https://github.com/Azure-Samples/active-directory-xamarin-native-v2/tree/main/2-With-broker
- Download the sample project, 
- Launch the [2-With-broker] project
- Try to login with broker
Expected behavior
Launch Microsoft Authenticator if installed. If not it should use in app browser instead.
Identity provider
Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)
Regression
No response
Solution and workarounds
No response