I'm building a .NET Maui app using VS2022. I'm testing it using the Android emulator. The app gets its data from an API that is running on my local machine. The API is called from C# code but also from JavaScript in a WebView component. I've been struggling for days with a certificate error. As a first step, I want to at least be able to call the API using the browser without certificate errors (see image below). I've tried generating a certificate and installing it on the emulator. I've also tried using the Mitm proxy. Nothing works :(
I'm building a .NET Maui app using VS2022. I'm testing it using the Android emulator. The app gets its data from an API that is running on my local machine. The API is called from C# code but also from JavaScript in a WebView component. I've been struggling for days with a certificate error. As a first step, I want to at least be able to call the API using the browser without certificate errors (see image below). I've tried generating a certificate and installing it on the emulator. I've also tried using the Mitm proxy. Nothing works :(
Share Improve this question edited Mar 2 at 6:59 Mark Evans asked Mar 2 at 6:32 Mark EvansMark Evans 1,3831 gold badge15 silver badges29 bronze badges 2- You you chaged network security config of your app to trust user installed certificates? Otherwise the user installed cert is ignored. developer.android/privacy-and-security/… Also make sure the certificate contains the IP 10.0.2.2 as Subject Alternative Name extension (DNS). – Robert Commented Mar 2 at 14:00
- Did you try to access the api from the browser in the android emulator? And did you install the certificate in your app? – Liyun Zhang - MSFT Commented Mar 7 at 9:47
1 Answer
Reset to default 0the certificate must be installed on the webserver that is serving the API. And reach the server via 443 port, not 7011.