[Bug] MSAL not working with MAUI in iOS
See original GitHub issueLogs and network traces https://pastebin.com/B7ux36cs (anonymized) and then https://pastebin.com/1tJTqDWE
Which version of MSAL.NET are you using? Microsoft.Identity.Client 4.39.0
Platform .NET MAUI preview 11 running on iOS
What authentication flow has the issue?
- Desktop / Mobile
- Interactive
- Integrated Windows Authentication
- Username Password
- Device code flow (browserless)
- Web app
- Authorization code
- On-Behalf-Of
- Daemon app
- Service to Service calls
Is this a new or existing app? This is a new app, but the same code does work in Xamarin.Forms/.iOS.
Repro
Create a .NET MAUI app from the default template, add MSAL and try to log in with AAD B2C. I use the following code to bootstrap MSAL:
AuthClient = PublicClientApplicationBuilder.Create(AuthConstants.ClientId)
.WithIosKeychainSecurityGroup(AuthConstants.IosKeychainSecurityGroups)
.WithB2CAuthority($"{AuthConstants.Authority}{AuthConstants.SigninPolicy}")
.WithRedirectUri($"msal{AuthConstants.ClientId}://auth")
.Build();
and
var result = await AuthClient
.AcquireTokenInteractive(AuthConstants.DefaultScopes)
.WithPrompt(Prompt.SelectAccount)
.WithUseEmbeddedWebView(true)
.ExecuteAsync().ConfigureAwait(false);
Expected behavior
To get a AuthenticationResult
like on Windows/Android.
Actual behavior Browser is closed and the debug log logs the attached exception and no user is logged in.
Additional context / logs / screenshots / links to code
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:9 (4 by maintainers)
Top Results From Across the Web
MAUI msal login issue on iOS
I have a MAUI application with SSO login, and it's working perfectly on android. But in iOS getting the below error while login....
Read more >MSAL Not Working With .Net MAUI For Mac Platform
I am trying to get Microsoft AAD Authentication using MSAL in .net Maui Mac Desktop Application. It works in Android and iOS but...
Read more >MSAL Not Working With .Net MAUI For Mac Platform
I am trying to get Microsoft AAD Authentication using MSAL in .net Maui Mac Desktop Application. It works in Android and iOS but...
Read more >MSAL Auth in MAUI Revisited: The .NET Show with Carl Franklin
Carl updates episode 24, "Calling Secured APIs with MSAL Auth in MAUI " to use .NET 7 and to also work on Windows...
Read more >Authenticate the .NET MAUI App with Azure AD
This article explains how to authenticate a .NET MAUI application using Azure Active Directory on Windows and Android platforms.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@bgavrilMS I just updated to MAUI preview 12 and now it does not compile anymore, as it does not find `AuthenticationContinuationHelper`.
I guess this is because MAUI does not support the Xamarin.iOS TFMs anymore (see here) and uses another more common one, which does not have this class.
Thank you for the update. I will finish the Android version of the app first to get something out to testers and then look into iOS again and see if I’m able to contribute something 😊.