'Ensure CORS request includes only allowed headers issue

I am trying to call the below API through React code:

const authAxio = axios.create({
  baseURL: 'https://test.azurewebsites.net/swagger',
});

authAxio
    .post(
      '/api/attachment',
      listToDownload,       
       { 
        headers: {
          'Ocp-Apim-Subscription-Key': 'test',
          'Access-Code-Key': 'test',
          'Access-Control-Allow-Origin' : '*', 
          'Access-Control-Allow-Credentials': true
        }, 
      }         
      )

But I am getting the below error when execute this:

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source