Hello guys, I had done a pretty good twitch clone with React and your API.
But since recently I have “error 501” everywhere and I’m so confused about what to do to use the API like before (If I can still use it like before.)
Before the API changes, here is how I was using the API :
import axios from 'axios';
let api = axios.create({
headers: {
'Client-ID' : 'xxxxxxxxxxxxxxxxxxxxxx'
}
})
export default api;
And then :
const fetchData = async () => {
const result = await api.get(
`https://api.twitch.tv/helix/streams?game_id=${location.state.gameID}`
);
}
With my research I went on this page but I really didn’t understand a thing :
Do I need to make a post request ? (I tried)
const result = await api.post('https://id.twitch.tv/oauth2/token?client_id=xxxxxxxxxx&client_secret=xxxxxxx&grant_type=client_credentials')
But I had this error : " Request header field client-id is not allowed by Access-Control-Allow-Headers in preflight response."
If someone can give me a hand and explain me in easy to understand english it would be awesome