6
I am simply trying to feed my application data from the Steam Api.
Let’s take this example: http://api.steampowered.com/ISteamUserStats/GetGlobalAchievementPercentagesForApp/v0002/?gameid=440&format=xml
Paste into the browser and it will work as due.
But when I do in the AngularJS
:
function getData(){
return $http.get('aquela url')
.then(function(response){
return response.data;
})
.catch(function(err){
console.log(err);
});
}
He always falls in the catch, with statuscode:0
as if the server was actively refusing my request.
What am I doing wrong?
In Chrome or Firefox, what the tab
Rede
ofFerramentas de Desenvolvimento
say about the request? And the console?– Vinícius Gobbo A. de Oliveira
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore not allowed access.
I know it’s a Cross Domain issue, but how do I fix it when I can’t touch the Steam Api? and another one I’m doing aget
, and not apost
– anisanwesley
I don’t think it’s possible. Browsers implement this policy for security reasons. Bypassing it would be a security problem.
– Vinícius Gobbo A. de Oliveira
So Steam makes an api that can’t be consumed. That doesn’t make much sense
– anisanwesley
Now that I’ve noticed, where’s your key API? Without it, you won’t be accessing.
– Vinícius Gobbo A. de Oliveira
This url does not require apikey, so if you paste it into the browser, it will work. For the other calls I have the proper apikey. Is there another way, or a "functional" library to access the Steam api? I’m testing Steamkit2 but without much success
– anisanwesley