I can't manage to make a CORS request from my electron app.I have set the required webSecurity
mainWindow = new BrowserWindow({ width: 1024, height: 768, show: false, webPreferences: { webSecurity: false } });
then trying to get data from zoho servers
fetch('https://books.zoho.com/api/v3/contacts\\?organization_id\\=12345', { method: 'get', headers: {'Authorization': "Zoho-authtoken 984fe68e7f564c6bs01ee9ffb1dsa140",'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' } }) .then(_result =>{ console.info("_result",_result); })
Headers I'm sending (from network tab), response is 400
GET /api/v3/contacts/?organization_id\=12345 HTTP/1.1Host: books.zoho.comConnection: keep-alivePragma: no-cacheCache-Control: no-cacheauthorization: Zoho-authtoken 987984fe68e7f564c6bs01ee9ffb1dsa140X-DevTools-Request-Id: 21105.4User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) basic-electron-react-boilerplate/0.7.0 Chrome/59.0.3071.115 Electron/1.8.8 Safari/537.36content-type: application/x-www-form-urlencoded;charset=UTF-8Accept: */*Referer: http://localhost:8080/index.htmlAccept-Encoding: gzip, deflateAccept-Language: en-GB
this request works when I curl
curl https://books.zoho.com/api/v3/contacts\?organization_id\=12345 -H 'Authorization: Zoho-authtoken 984fe68e7f564c6bs01ee9ffb1dsa140' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8"