Hi ,
I'm facing an SSL certificate validation issue while calling our API from a .NET MAUI Android application.
Our API is hosted behind Azure Application Gateway, and we are using the Application Gateway URL provided by our backend team.
The same API is working as expected in Postman, and I'm able to retrieve the response successfully.
I also tested the endpoint directly using the Chrome browser in BrowserStack App Live, and it returns the response successfully. However, when I call the same endpoint from our MAUI Android application, I'm unable to retrieve the response.
While debugging the application, I found the following exception:
Java.Security.Cert.CertPathValidatorException: Trust anchor for certification path not found
Things we have verified so far:
- The API is working in Postman, with SSL certificate verification enabled.
The endpoint returns a response when accessed directly through the BrowserStack Chrome browser.
Our backend team confirmed that a valid SSL certificate is configured on the Application Gateway.
The certificate chain was checked, and the team confirmed that the Android and Apple certificate checker results are the same.
We are using the standard HttpClient in our MAUI application without any custom certificate validation handler.
I also tried configuring Android Network Security Config to trust system and user certificates in Debug mode, but the issue still persists.
Development Environment:
.NET MAUI 10
Android application
Testing using a local Android emulator and BrowserStack App Live
Standard HttpClient
Could you please help us identify why the Android application is failing to validate the SSL certificate even though the same API works in Postman and the browser?
Is there any additional configuration required in .NET MAUI Android or Android HttpClient to resolve this issue?
Thanks.