I have developed MAUI application and .net core API separately. After I published my .net core API on the IIS Server API, mobile application (Android) fails API calls. But in debug mode It worked fine. After I published the API I changed the base URL into a domain name. I’m sure my API is working because I use postman and API tester (for mobiles) to verify it.
Here is my code….
var loginData = new { Username = username, Password = password };
#if DEBUG
HttpsClientHandlerService handler = new HttpsClientHandlerService();
HttpClient client = new HttpClient(handler.GetPlatformMessageHandler());
#else
HttpClient client = new HttpClient();
#endif
client.BaseAddress = new Uri(DeviceInfo.Platform == DevicePlatform.Android ? "https://apps.example.com:93/HRA_API1" : "https://apps.example.com:93/HRA_API1");
var response = await client.PostAsJsonAsync("api/Auth", loginData);
Why my mobile app restrict these api calls even when I testing it on postman works fine. Please help me solve this problem.