Searching for a decision on login I keen token I got in cookie 'external_token'
const headers = {
'Content-Type': 'application/json',
'X-Auth-Token': getCookie('external_token'),
'Access-Control-Allow-Origin' : '*',
"Access-Control-Allow-Methods": "GET",
};
axios.get(user_details_url, headers)
.then((response) => {
...
})
.catch((err) =>{
})
But I got error in console :
Access to XMLHttpRequest at 'http://remoteserver.com/api/user' from origin 'http://local-wiznext.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
where remoteserver.com is remote server with API and http://local-wiznext.com is my local server I am developing at
Searching for a decision I found several additive parameters to add to header of my axios request :
const headers = {
'Content-Type': 'application/json',
'X-Auth-Token': getCookie('external_token'),
'Access-Control-Allow-Origin' : '*',
"Access-Control-Allow-Methods": "GET",
'crossDomain': true,
'dataType': 'jsonp',
};
But I got the same CORS error. If there is a way to fix this error and run request?