I've encountered the error above while using Axios for a GET request to an external API. Despite consulting the Mozilla documentation, conducting thorough research, and experimenting with different approaches, I haven't made any progress.
I've simplified the code to its basics:
axios.get('URL.com', {
headers: {
Access-Control-Allow-Origin: *
},
auth: {
username: 'username',
password: 'password'
},
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
Do I need to include additional information in the headers?
Everything functions correctly on Postman, so resolving the CORS issue will ensure everything works smoothly.