net: ERR_CERT_COMMON_NAME_INVALID in API call using Flutter web

160 Views Asked by At

I am trying to call an https connection in flutter web,

  import 'package:http/http.dart' as http; 

  Map<String, String> requestHeaders = {
   'Content-type': 'application/json',
   'Api-key': 'ab1234-98765xyz',
   'Authorization-key': 'abcd12345xyzcvbn'
 };
  String url='https://api.xyz.com/users/info';
  final response = await http.get(Uri.parse(url), headers: requestHeaders);
 print(response.body);

but I am getting error

   net: ERR_CERT_COMMON_NAME_INVALID. 

The calling method is a GET method with some required header. On postman I am able to get the response but on flutter web getting the issue.

How to call a secured https API, Please advise

Thank You

0

There are 0 best solutions below