webdataconnector
webdataconnector copied to clipboard
CORS policy not being bypassed
I am trying to write an connector that requires a user to send in a ClientID and Secret through OAuth2 as client_credentials in order to get an access token. I can successfully use the "post" connector method to retrieve the data, however, when I go to create a request to our API, I get 405 errors and CORS exceptions, even though I am passing the request options to bypass CORS policy.
return new Promise(function (resolve, reject) { let requestOptions = { bypassCorsPolicy: true, headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' } }; let endpoint = "API Path"; let requestBody = {};
post(endpoint, requestBody, requestOptions)
.then(data => {
console.log('Get Groups successful!');
console.log(data); // Process the response data
})
.catch(error => {
console.error('Error:', error);
});
});