I'm trying to use MSAL in a .NET MAUI Blazor hybrid app (net10.0-android, .NET SDK 10.0.100, Android API 36.0).
I'm trying to get the user to log in interactively. The code I'm calling is an internal library that essentially wraps this call:
await publicClientApplication.AcquireTokenInteractive(".default");
My IPublicClientApplication has been correctly configured with the Azure client ID as well as the parent Activity, and I've added the required BrowserTabActivity so it can redirect back to my app.
When I sign in, I am redirected back to the app, but it seems that the AcquireTokenInteractiveAsync Task never completes. At least that's my best theory as I also can't seem to get breakpoints to work on Android, but I don't see the effects of any code after awaiting the Task (logging, exception throwing).
I suspect this is something specific to Android that I'm missing, since the process works as expected on Windows.
(Of course I find it immediately after posting the question...)
I was missing this override in my MainActivity:
using Microsoft.Identity.Client; protected override void OnActivityResult(int requestCode, Result resultCode, Intent? data) { base.OnActivityResult(requestCode, resultCode, data); AuthenticationContinuationHelper.SetAuthenticationContinuationEventArgs(requestCode, resultCode, data); }