0

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

Faiz Anwar
  • 658
  • 2
  • 9
  • 18
  • 1
    `ERR_CERT_COMMON_NAME_INVALID` usually indicates a problem with the used server certificate. May be Postman uses the oudtaed check only for the common name in the `subject` attribute and not in `subjectAlternativeName` which is not the default. Check your server for problems: https://www.ssllabs.com/ssltest/ – Robert May 17 '23 at 07:52

0 Answers0