0
Okay, guys, I’m having a problem making a request with the Riot Games API. Response returns code 200, which is the code of when the request worked, but I cannot handle the object returned by json because of an error that is happening. NOTE: I’m a bit of a beginner in JS
Code: Let Axios = require('Axios')
axios.get('https://br1.api.riotgames.com/lol/summoner/v4/summoners/by-name/usuario?api_key=minhaApiKey')
.then(resposta => document.write(resposta.name))
.catch(error => console.log(error))
You know how CORS works?
– Felipe Avelar
Another thing, in the image, you are showing the secret of your key to the API...
– Felipe Avelar
You are accessing an API with direct link,
https://...
, that is, it is not taking a path from your project, apparently this api does not allow to be used in this way, in this case, your current domain needs to be listing as permissive within the server of this api, for its return. This is done on the server side.– Ivan Ferrer
Behold if it helps you.
– Ivan Ferrer