Request Blocked by CORS Policy - VueJS
Categories
- 276 All Categories
- 4 LexiStats Corner
- 12 Review my code
- 6 Tutorials and presentations
- 89 Frequently asked questions
- 5 How to get useful technical help
- 2 Member guidelines
- 12 Suggest an improvement
- 56 Report a bug
- 7 Ask the Community: Other
- 52 Ask the Community: Technical and operational questions
- 57 General
Request Blocked by CORS Policy - VueJS
Hi,
When try Oxford API with Postman there is no problem but when I try to use it on my Vue project request keep blocked by CORS Policy.
my code is:
methods: { getWord() { Axios.get(
https://od-api.oxforddictionaries.com/api/v2/entries/en-gb/${this.word
}?fields=definitions&strictMatch=false, { headers: { Accept: 'application/json', app_id: '00000000000', app_key: 'xxxxxxxxxxxxxxxxxxxxx', }, }).then((response) => { console.log('-----SUCCESS-----'); this.posts = response; console.log(this.posts); }).catch((err) => { console.log(
this is the error: ${err}); }); }, };
Browser gives this error:Access to XMLHttpRequest at 'https://od-api.oxforddictionaries.com/api/v2/entries/en-gb/cat?fields=definitions&strictMatch=false' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Appreciate any help.
P.S.: word is cat
Comments
Hello @mertugrul20
I've forwarded your question to my colleagues in the technical team so hopefully myself or one of them should be able to get back to you - bear with us!
Hello @mertugrul20
Sorry for the late response.
My colleagues from the technical team have informed me that the API blocks all the requests using COR request, for security reasons.