[Bug] MAUI, API 35, Embedded WebView cuts off top content
Library version used
4.73.1
.NET version
.NET 9, MAUI 9.0.70
Scenario
PublicClient - mobile app
Is this a new or an existing app?
The app is in production, and I have upgraded to a new version of MSAL
Issue description and reproduction steps
Recently with Google requiring all Android applications on Google Play to be compiled with targetSDK 35. After switch from API 34 to API 35 we noticed that on newer phones/emulators Embedded WebView is now cutting of portion of the page used for sign in, cutting out the logo.
The issue is most probably due to Edge-to-Edge system that has been introduced/forced for API 35+ android apps.
Relevant code snippets
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="35"/>
MauiAppBasic is used, configuration pasted from the production application to have exact reproduction.
When adding targetSdkVersion="35" and using Android device with SDK 35 the issue happens.
https://github.com/Azure-Samples/ms-identity-dotnetcore-maui
Expected behavior
Full website should be shown.
Identity provider
Azure B2C Custom Policy
Regression
No response
Solution and workarounds
Custom WebUI
Hi all, any update? I am experiencing the same issue
Hi all, any update? I am experiencing the same issue
Tested with
"Microsoft.Identity.Client" Version="4.76.0" and "Microsoft.Identity.Client" Version="4.58.1"
Probably the issue is not regarding the package, but the update to API35.
.NET 9, MAUI 9.0.100
We're also seeing this issue and found this related github issue in the native Java client as well. Since Google will not be accepting any application submissions less than API 35 anymore I expect this is a blocker for a lot of organizations. Any hope on a near-term fix? We're currently in the process of preparing for a release and this will prevent us from being able to release a new version.
I can suggest a workaround of a custom web ui. You can just use a webview to show the content. works pretty nicely. https://learn.microsoft.com/en-us/entra/identity-platform/scenario-desktop-acquire-token-interactive?tabs=dotnet#withcustomwebui
@gladjohn can you take a look at this? Thanks
I can suggest a workaround of a custom web ui.
In case anybody else is stuck unable to release waiting for the official fix, we've been able to temporarily work around this issue using the approach mentioned by @MerSpyro here, though I can see how it would be non-trivial for some. Initially I attempted to solve this using Chrome Custom Tabs but for some reason the MainActivity was being terminated whenever the user interacted with the browser which was breaking the redirectUri callback since it was losing the in-progress auth state, so we ended up with a standard MAUI ContentPage with a WebView in it using Navigating/Navigated event handlers and such. Had to wire up the back button manually among other little idiosyncrasies related to our app's use of different root pages (some that use NavigationPage and other scenarios that don't).