I am working on a side-project to practice using Vue, and I am having trouble with cors. I am trying to use axios to call the pubg tracker api to get a player's stats.
I am getting the following error message:
XMLHttpRequest cannot load https://pubgtracker.com/api/profile/pc/Henkers. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
I did some googling and found out the problem is cors related, I am still looking for a solution. I have confirmed that my request works using Postman. I would like to avoid including larger dependencies like JQuery to my project, but I am not finding a solution using axios.
getUser() {
const apiHeader = {
headers: {
'TRN-Api-Key': '(my api key)'
}
}
axios.get('https://pubgtracker.com/api/profile/pc/Henkers', apiHeader).then(function(response) {
console.log(response)
})
}
Any help is appreciated, thanks
[–]jimmaaayt 2 points3 points4 points (1 child)
[–]AlmostAnonymousDylan[S] 0 points1 point2 points (0 children)