Google OAuth in Android 16 .NET 9 MAUI app is not working - getting 401 malformed error
07:47 23 Apr 2026

I have created an Android MAUI application targeting the Android framework version 15 (API level 35), which has been published on the Google Play Store.

I have implemented a Login with Google feature utilizing OAuth and WebAuthenticator, and it is functioning correctly.

Currently, I aim to restrict access for non-organizational emails from the backend, for which I have made necessary code modifications. When I attempt to log in with a non-organizational email, I receive an error message and am able to redirect to the app. This functionality works on Android versions 11 through 15.

However, on Android 16, I am unable to log in using an organizational email. I encounter a 401 - malformed error and am not redirected to the app. Please refer to the image below for further clarification:

enter image description here

For domain restriction, I have updated code as below:

WebAuthenticationCallbackActivity.cs

[Activity(NoHistory = true, LaunchMode = LaunchMode.SingleTop, Exported = true)]
[IntentFilter(
new[] { Intent.ActionView },
Categories = new[]
{
    Intent.CategoryDefault,
    Intent.CategoryBrowsable
},
DataScheme = "myapp",
              DataHost = "callback")]
public class WebAuthenticationCallbackActivity : Microsoft.Maui.Authentication.WebAuthenticatorCallbackActivity
{
}

LoginViewModel.cs

var authResult = await WebAuthenticator.Default.AuthenticateAsync(
    new Uri(APIEndpoint + "/api/mobileauth/Google"),
    new Uri("myapp://callback"));

Right now we have added below code in backend.

Backend code:

const string callbackScheme = "myapp" 
var finalDeepLink = $"{callbackScheme}://callback?access_token={Uri.EscapeDataString(stringToken)}&expires_in={expiresIn}";     
var deepLink = $"{callbackScheme}://callback?error={Uri.EscapeDataString(errorCode)}";

As per research, targeting Android 15 (API 35) is not the issue.

What changes needs to be done to work this in Android 16?

android google-oauth maui